AnsweredAssumed Answered

how to get base map ids from basemap gallery arcgis js (i.e. topo)

Question asked by trying2drawlinebetween2points on Jan 27, 2020
Latest reply on Jan 29, 2020 by trying2drawlinebetween2points
Context: I am trying to simply create a 'Save Button' from selection of basemap in basemap gallery...

The only thing missing is I cannot find the 'well known string ids' from the basemaps in the basemap gallery for which I can use to reference later, i.e. streets, streets-vector, topo dark-gray, etc etc.

I am getting the objects responses with the below on any change of selection to the basemap gallery, I am seemingly getting EVERYTHING back but the 'well known string ids' in which I can save and use later to render that basemap. I am getting the title and property ID but the ids to change the map, i.e. topo are no where to be found within the object responses.

basemapGallery.watch('activeBasemap', function(newBasemap, property, object)        console.log('new active basemap', {newBasemap, property, object});.......... // also have tried pulling in the basemap obj here as well

i.e. I can programmatically, manually, change the basemap in my application or in the dev console with the below.

myapp.widgets.basemapManager.basemapGallery.activeBasemap = "streets"

The docs lead me to believe I can use portal item id to reference the basemaps but this did not work. I have tried to reference it every which way in accordance to the above line.

Below is a screenshot of my watch function after a selection has been made to the basemap gallery. No named string ids to change the map found, i.e. 'dark-grey' 'topo' 'streets' etc.

enter image description here

Outcomes