//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; } } });
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.