<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Is it possible to get basemap short name? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-get-basemap-short-name/m-p/416820#M38339</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&amp;nbsp; e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var map = new Map({ basemap: "topo" });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Will load the Topographic map.&amp;nbsp; According to the api:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The following are valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm". As of version 3.3&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;map.getBasemap() then returns the short name of the basemap it was loaded with, e.g "topo".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm then using the Basemap Gallery to allow the basemap to be changed.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can get the currently selected basemap from the BasemapGallery using basemapGallery.getSelected().&amp;nbsp; The object this returns has a name property but this is the basemaps full name, i.e. "Topographic", "Imagery with Labels" etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Simon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 27 Jun 2014 10:16:40 GMT</pubDate>
    <dc:creator>SimonHodge</dc:creator>
    <dc:date>2014-06-27T10:16:40Z</dc:date>
    <item>
      <title>Is it possible to get basemap short name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-get-basemap-short-name/m-p/416820#M38339</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;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.&amp;nbsp; e.g.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt;var map = new Map({ basemap: "topo" });&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Will load the Topographic map.&amp;nbsp; According to the api:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;The following are valid options: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm". As of version 3.3&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;map.getBasemap() then returns the short name of the basemap it was loaded with, e.g "topo".&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm then using the Basemap Gallery to allow the basemap to be changed.&amp;nbsp; 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.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can get the currently selected basemap from the BasemapGallery using basemapGallery.getSelected().&amp;nbsp; The object this returns has a name property but this is the basemaps full name, i.e. "Topographic", "Imagery with Labels" etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;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?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Simon&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 27 Jun 2014 10:16:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-get-basemap-short-name/m-p/416820#M38339</guid>
      <dc:creator>SimonHodge</dc:creator>
      <dc:date>2014-06-27T10:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to get basemap short name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-get-basemap-short-name/m-p/416821#M38340</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;It appears map.getBasemap() returns the basemap used in map constructor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You can easily get title of a &lt;/SPAN&gt;&lt;SPAN style="font-style:italic;"&gt;selected&lt;/SPAN&gt;&lt;SPAN&gt; in the Basemap gallery map. Example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://developers.arcgis.com/javascript/samples/widget_basemap/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://developers.arcgis.com/javascript/samples/widget_basemap/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Select a basemap, then:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var b = dijit.byId('basemapGallery');
var s = b.getSelected();
var title = '';

if (s) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; title = b.getSelected().title;
}

console.log(title);
&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:51:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/is-it-possible-to-get-basemap-short-name/m-p/416821#M38340</guid>
      <dc:creator>KonstantinLapine</dc:creator>
      <dc:date>2021-12-11T18:51:49Z</dc:date>
    </item>
  </channel>
</rss>

