Using the JavaScript API 4.8, how can I create a basemap gallery with just the Imagery and Streets basemaps?
This is what I'm using to create the basemapGallery:
basemapGallery = new BasemapGallery({ view: view, container: document.createElement("div") });
Thanks,
Shane
Shane,
See this thread where I show a sample on how to remove certain basemaps.
https://community.esri.com/thread/217248-how-do-i-remove-basemaps-from-the-default-47-basemapgallery
Thanks Robert.
I tried to use basemapGallery.source.basemaps.removeAt(2);
directly after I have created the basemapGallery i.e. on the line following
basemapGallery = new BasemapGallery({ view: view, container: document.createElement("div") });
but it doesn't work. Any suggestions?
Thanks,
Shane
Shane that is why in my sample code I do not try to remove it right after I create the list.
watchUtils.once(basemapGallery.source.basemaps,"length", function(state){
setTimeout(function(){
basemapGallery.source.basemaps.removeAt(2);
}, 200);
});
You can use `PortalBasemapsSource#filterFunction` for this purpose. Here's an example: [BasemapGallery] Filter basemaps