Bug in Basemap Gallery dijit

3486
3
Jump to solution
07-31-2015 12:18 PM
KenBuja
MVP Esteemed Contributor

In this sample, if a map is instantiated with the "hybrid" basemap (imagery and labels), the labels remain when the new basemap is selected from the gallery. If the map is instantiated with the "terrain" basemap (terrain, linework, and labels), the linework and labels remain.

See it in action here: Plunker

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

This was identified by Esri support as a bug: BUG-000089550

The initial workaround was to manually remove the reference overlay from the map's layer list the first time a new map is selected from the basemap gallery widget. However, since my application added the basemap through a configuration file, I couldn't always be sure a basemap with a reference layer would be used in the map construction.

Initially, support tried to use the map property basemapLayerIds, but this only works on the first change of the basemap. The property isn't changed when the basemap changes. Instead, the workaround uses the map's load event.

      map.on("load", function(){
        console.log(map);
        var basemaps = map.basemapLayerIds;
        setTimeout(function() {
            for(var index = 0; index < basemaps.length; index++) {
                var layer = map.getLayer(basemaps[index]);
                layer._basemapGalleryLayerType = "basemap";
                console.log(layer);
            }
        }, 2000);
      });

View solution in original post

3 Replies
KenBuja
MVP Esteemed Contributor

This was identified by Esri support as a bug: BUG-000089550

The initial workaround was to manually remove the reference overlay from the map's layer list the first time a new map is selected from the basemap gallery widget. However, since my application added the basemap through a configuration file, I couldn't always be sure a basemap with a reference layer would be used in the map construction.

Initially, support tried to use the map property basemapLayerIds, but this only works on the first change of the basemap. The property isn't changed when the basemap changes. Instead, the workaround uses the map's load event.

      map.on("load", function(){
        console.log(map);
        var basemaps = map.basemapLayerIds;
        setTimeout(function() {
            for(var index = 0; index < basemaps.length; index++) {
                var layer = map.getLayer(basemaps[index]);
                layer._basemapGalleryLayerType = "basemap";
                console.log(layer);
            }
        }, 2000);
      });
KenBuja
MVP Esteemed Contributor

An update on this bug:

The status of Esri BUG-000089550 - When using the Basemap Gallery widget in the ArcGIS JavaScript API if the map is instantiated with a basemap that has a reference overlay the labels remain when the new basemap is selected. - that you have been associated with has been changed to Not in Current Product Plan.
Public Explanation: No plans to address for 3.x

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

That's a little disappointing.

0 Kudos