<?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 map.getBasemap() not updating with the new base map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652294#M60800</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been working with BasemapGallery, and the Map class. My problem is that when I change the basemap with the basemapgallery then I try to access to&amp;nbsp; map.getBasemap() and is returning the same basemap that when the Map class was instantianted. It seems that the basemap in the Map class is not updating each time that I change the basemap with the BasemapGallery.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance and sorry for my English&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 21 Jan 2014 13:24:06 GMT</pubDate>
    <dc:creator>EkaitzHernandez</dc:creator>
    <dc:date>2014-01-21T13:24:06Z</dc:date>
    <item>
      <title>map.getBasemap() not updating with the new base map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652294#M60800</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi all!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have been working with BasemapGallery, and the Map class. My problem is that when I change the basemap with the basemapgallery then I try to access to&amp;nbsp; map.getBasemap() and is returning the same basemap that when the Map class was instantianted. It seems that the basemap in the Map class is not updating each time that I change the basemap with the BasemapGallery.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance and sorry for my English&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 21 Jan 2014 13:24:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652294#M60800</guid>
      <dc:creator>EkaitzHernandez</dc:creator>
      <dc:date>2014-01-21T13:24:06Z</dc:date>
    </item>
    <item>
      <title>Re: map.getBasemap() not updating with the new base map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652295#M60801</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ekaitz,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Welcome to Esri Forum! Thank you for posting your question here.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I looked at our &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jssamples/widget_basemap.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Basemap gallery&lt;/A&gt;&lt;SPAN&gt; sample, and you are correct, the map.getBasemap() returns the same basemap that the map was initialized with (e.g. "topo").&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think what you need to do to return the basemap from the basemap gallery widget is to use the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/basemapgallery.html#getselected" rel="nofollow noopener noreferrer" target="_blank"&gt;getSelected()&lt;/A&gt;&lt;SPAN&gt; method.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is a code snippet that should work for that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(basemapGallery,"onSelectionChange",function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var basemap = basemapGallery.getSelected(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(basemap.title);
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Hope this helps!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Noah&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:39:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652295#M60801</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2021-12-12T03:39:08Z</dc:date>
    </item>
    <item>
      <title>Re: map.getBasemap() not updating with the new base map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652297#M60803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi Ekaitz,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I think I understand what you're saying. The issue is that you are comparing default Esri map basemaps from the JavaScript API to basemaps from ArcGIS.com.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Using the map constructor, valid basemap options from the JavaScript API are: "streets" , "satellite" , "hybrid", "topo", "gray", "oceans", "national-geographic", "osm". These are the default Esri basemaps that the JavaScript API can access and return.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jssamples/widget_basemap.html"&gt;Basemap gallery sample&lt;/A&gt;&lt;SPAN&gt; uses the: "BasemapGallery widget to update the map's basemap. This widget presents a gallery of base maps that can be user-defined or generated by a query from ArcGIS.com. In this snippet a new BasemapGallery widget is created that contains basemaps from ArcGIS.com". Thus, these basemaps may not have the same name as the basemaps from the map constructor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you look at the &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jssamples/widget_toggle.html"&gt;Basemap Toggle sample&lt;/A&gt;&lt;SPAN&gt;, you can see that the "map.getBasemap()" method returns the actual name of the current basemap when you switch between them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;That being the case, you have several options moving forward, depending on what you wish to accomplish. You could create your own custom basemaps, and call them whatever you want. You could use the Esri basemaps that the JavaScript API can access and return in a &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/basemapgallery-amd.html"&gt;basemap gallery dijit&lt;/A&gt;&lt;SPAN&gt; or &lt;/SPAN&gt;&lt;A href="https://developers.arcgis.com/en/javascript/jsapi/basemaptoggle-amd.html"&gt;basemap toggle dijit&lt;/A&gt;&lt;SPAN&gt; style, and have the names be the same there as they are in the map constructor.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;-Noah&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2014 14:51:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652297#M60803</guid>
      <dc:creator>Noah-Sager</dc:creator>
      <dc:date>2014-01-22T14:51:41Z</dc:date>
    </item>
    <item>
      <title>Re: map.getBasemap() not updating with the new base map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652296#M60802</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi nsager, thank you for you reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I tried out with that method before, however the problem that&amp;nbsp; is returning different title that the title that I need in map.setBasemap("topo"). The problem is that title is "Topograpich" instead "Topo" that is the method that I need in setBasemap or when you need create a new map like here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; map1 = new Map("map1", {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; basemap: "topo",
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; center: [-105.255, 40.022],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zoom: 3
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Do you know what I am trying to say?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Hi Ekaitz,&lt;BR /&gt;&lt;BR /&gt;Welcome to Esri Forum! Thank you for posting your question here.&lt;BR /&gt;&lt;BR /&gt;I looked at our &lt;A href="https://developers.arcgis.com/en/javascript/jssamples/widget_basemap.html" rel="nofollow noopener noreferrer" target="_blank"&gt;Basemap gallery&lt;/A&gt; sample, and you are correct, the map.getBasemap() returns the same basemap that the map was initialized with (e.g. "topo").&lt;BR /&gt;&lt;BR /&gt;I think what you need to do to return the basemap from the basemap gallery widget is to use the &lt;A href="https://developers.arcgis.com/en/javascript/jsapi/basemapgallery.html#getselected" rel="nofollow noopener noreferrer" target="_blank"&gt;getSelected()&lt;/A&gt; method.&lt;BR /&gt;&lt;BR /&gt;Here is a code snippet that should work for that.&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
dojo.connect(basemapGallery,"onSelectionChange",function(){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var basemap = basemapGallery.getSelected(); 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; alert(basemap.title);
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps!&lt;BR /&gt;&lt;BR /&gt;-Noah&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 03:39:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/map-getbasemap-not-updating-with-the-new-base-map/m-p/652296#M60802</guid>
      <dc:creator>EkaitzHernandez</dc:creator>
      <dc:date>2021-12-12T03:39:10Z</dc:date>
    </item>
  </channel>
</rss>

