I'm working on a web app that has multiple mapviews, built on node (so not using CDN). We have one primary map that has a basemap selector, and I'd like to propagate the basemap that one is using to others. As the user moves around the app, there are instances where maps are destroyed and removed from the page, and I'd prefer to just recreate new resources rather than have to write code for each to remove things like the basemap before calling .destroy().
---------------------
====================
I don't understand why this occurring. Is this a bug in the SDK? I see nothing in the output on the console.
I have the same issue using the same LocalBasemapsSource for two maps. I tried making two identical variables, but that also did not work.
Turns out I was getting a "Basemap already destroyed" error. The basemaps were being destroyed by the first map and weren't able to be used again. The solution I got to was making a function
export const GenerateLocalBasemapsSource = () => {
const topovector = Basemap.fromId("topo-vector") as Basemap
const streets = Basemap.fromId("streets") as Basemap
const satellite = Basemap.fromId("satellite") as Basemap
return new LocalBasemapsSource({basemaps: [ satellite, topovector, streets ]}) }
Then calling the function to get the source for my basemap gallery like so:
<arcgis-basemap-gallery source={GenerateLocalBasemapsSource()}/>