Select to view content in your preferred language

BasemapGallery labels issue

1187
5
Jump to solution
02-06-2014 06:38 AM
JeffreySchmidt
Deactivated User
Hi all,

I have been working with the basemapGallery dijit and I noticed a bug... I was testing this in the sandbox:

http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=widget_basemap

The issue occurs when the map is initiated with the basemap: 'hybrid' . 

Ex. new Map("map", {basemap: "hybrid"....});

If a user then selects the satellite option from the basemapGallery, or any other, the labels for the hybrid imagery remain on the screen...  Initiating with basemap: "satellite", switching to hybrid.... and then back to satellite... removes labels as it should. 

Any solutions?  Thanks for reading...
Jeff
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Deactivated User
i agree this looks like a bug.

heres a technique you could use to workaround the issue.

//make a flag so that we only pull out the second basemap layer the first time its changed var isFirst = true; ... basemapGallery.on("selection-change", function() {     if (isFirst) {         //check to make sure that the first basemap shown actually displayed two different tiled layers         if (basemapGallery.getSelected().title == "Imagery with Labels" || basemapGallery.getSelected().title != "Light Gray Canvas" || basemapGallery.getSelected().title != "Terrain with Labels") {                         map.removeLayer(map.getLayer(map.layerIds[1]));             //set the flag to false so none of this code fires again             isFirst = false;                     }     }           });

View solution in original post

0 Kudos
5 Replies
JeffreySchmidt
Deactivated User
This also occurs when initiating the map with the basemap: "gray".  The labels are retained when switching to a different basemap using the basemapGallery
0 Kudos
JohnGravois
Deactivated User
i agree this looks like a bug.

heres a technique you could use to workaround the issue.

//make a flag so that we only pull out the second basemap layer the first time its changed var isFirst = true; ... basemapGallery.on("selection-change", function() {     if (isFirst) {         //check to make sure that the first basemap shown actually displayed two different tiled layers         if (basemapGallery.getSelected().title == "Imagery with Labels" || basemapGallery.getSelected().title != "Light Gray Canvas" || basemapGallery.getSelected().title != "Terrain with Labels") {                         map.removeLayer(map.getLayer(map.layerIds[1]));             //set the flag to false so none of this code fires again             isFirst = false;                     }     }           });
0 Kudos
JohnGravois
Deactivated User
yup, just confirmed that this problem has definitely already been logged.

[NIM089693: If the BasemapGallery widget is initialized with a basemap that has a reference service for labels, the labels continue to display after switching to other basemaps.]

sorry for the inconvenience.
0 Kudos
JeffreySchmidt
Deactivated User
Thank you for the code jgravois!  Do you know if there is a page where I may view the logged bugs/coming updates?
0 Kudos
JohnGravois
Deactivated User
0 Kudos