AnsweredAssumed Answered

How do I select which basemap is selected in the gallery AT STARTUP?

Question asked by eliprandi on Jul 24, 2015
Latest reply on Jul 28, 2015 by rscheitlin

Here is our situation:

  • users can have a custom list of basemaps
  • we use the BasemapGallery to allow them to select their basemap
  • we persist the basemap id in a cookie to load that same basemap the next time they visit their app

 

At this point what is the official way to load the Basemap gallery against a map with a specific basemap selected?

 

The only 2 lines of code involved in setting up the gallery with the map are:

var gallery = new BasemapGallery( options );
gallery.startup();

 

As far as we can tell, there is nothing in the options that allows this. We don't see a selected property on the Basemap.

So far, our only option is to let it load the gallery, using the first basemap, then, as soon as it's loaded, call select(id) on the gallery. But as you can guess, the experience is horrible at best. The map loads first with a basemap and within a second or two switches to the one the user really wanted.

Outcomes