Is it possible to get basemap short name?

Discussion created by hodges@rpsgroup.com on Jun 27, 2014
Latest reply on Jun 27, 2014 by klapine
When you create a map you can pass it an options object and specify the name of the basemap to load using a short name for each of the standard basemaps.  e.g.

var map = new Map({ basemap: "topo" });

Will load the Topographic map.  According to the api:

The following are valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm". As of version 3.3

map.getBasemap() then returns the short name of the basemap it was loaded with, e.g "topo".

I'm then using the Basemap Gallery to allow the basemap to be changed.  However, even after changing the basemap via the Basemap Gallery, calling map.getBasemap() always returns the name of the basemap that the map was loaded with, not the name of the currently selected basemap.

You can get the currently selected basemap from the BasemapGallery using basemapGallery.getSelected().  The object this returns has a name property but this is the basemaps full name, i.e. "Topographic", "Imagery with Labels" etc.

Does anyone know how to get the short name of a basemap after it's been changed using the basemap gallery, or anything built in that can translate full names back to short names?