I instantiate my map with the basemap set to "hybrid". The hybrid basemap automatically has a reference layer added to display labels for various places. Now, if I switch the basemap via a basemap gallery to something like "imagery" where there should be no reference labels, the reference labels still persist. If I switch it to other basemaps, again, the references persist whether they're supposed to or not. How can I remove the reference layer for basemaps that aren't supposed to have it?
If I instantiate my map with "satellite" first, all the basemaps work as expected when switching between them (things that are supposed to have labels, have labels. Things that aren't supposed to have labels don't).
I see there is a property that would allow me to remove the reference layer when switching maps, but since the reference layer is automatically added, I don't know what the 'id' of it is.
Code (the reference layer persists when switching basemaps):
map = new Map("map", {
basemap: "hybrid",
center: [-85.603281, 36.241294],
zoom: 6
});
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "gallery");
basemapGallery.startup();
Code (the basemaps work as expected, reference layer does not persist if it's not supposed to):
map = new Map("map", {
basemap: "satellite",
center: [-85.603281, 36.241294],
zoom: 6
});
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "gallery");
basemapGallery.startup();