<?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 Re: Hiding, Removing, or Changing AGOL Basemap in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608222#M56884</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Understood.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried removing the base map layer with Map#removeLayer()? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;map.removeLayer( map.getLayer("layer0") );&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It appears that "layer0" is always the base map's layer ID, but I don't know whether that is guaranteed. I took a look at the properties of each layer, and the best one I can find for identifying the base map layer is the url property. E.g., the url for the topographical map when loaded from the public JSAPI is this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 28 May 2013 18:09:41 GMT</pubDate>
    <dc:creator>BradCollins</dc:creator>
    <dc:date>2013-05-28T18:09:41Z</dc:date>
    <item>
      <title>Hiding, Removing, or Changing AGOL Basemap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608219#M56881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the Javascript API to load map layers from a Web Map.&amp;nbsp; I know this Web Map requires a default Basemap.&amp;nbsp; However, if I want to remove this basemap programmatically later, how would I do that?&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Right now I'm creating WebTiledLayer(s) and adding them with map.addLayer(basemap).&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Of course, this just adds another basemap on top of the default basemap defined in the WebMap.&amp;nbsp; (You can tell the default basemap is still there when panning around the map).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a quick statement I can use to disable or remove the default basemap?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 15:58:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608219#M56881</guid>
      <dc:creator>DanielTrone</dc:creator>
      <dc:date>2013-05-28T15:58:43Z</dc:date>
    </item>
    <item>
      <title>Re: Hiding, Removing, or Changing AGOL Basemap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608220#M56882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;&lt;BR /&gt;I know this Web Map requires a default Basemap.&lt;BR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I don't think that's true. Apparently you just need to create a Map object without a "basemap" property in the constructor args.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I've created a Map without a base map with the following code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var map = new esri.Map("map");
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;And then I add my layers after that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, take a look at the sample here:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/layers_webtiled_many.html" rel="nofollow noopener noreferrer" target="_blank"&gt;http://help.arcgis.com/en/webapi/javascript/arcgis/jssamples/layers_webtiled_many.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It does not have a base map, and it loads a WebTiledLayer on demand when the user selects the web tile source. Here's the Map object construction code:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; map = new esri.Map("map", {&amp;nbsp;&amp;nbsp; // note: no "basemap: 'streets'" in the following args
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; slider: false,
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; resizeDelay: 100, // 300ms(default) seemed a little slow in this case
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; center: [-89.985, 29.579],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; zoom: 8
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; });
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The WebTiledLayer is added later:&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;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // alias for WebTiledLayer constructor
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var wtl = esri.layers.WebTiledLayer;

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ...

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var lyr = new wtl(l.url, l.options);
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So then, try creating your Map without a "basemap" item in the constructor args, and I think you'll be fine.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:02:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608220#M56882</guid>
      <dc:creator>BradCollins</dc:creator>
      <dc:date>2021-12-12T02:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hiding, Removing, or Changing AGOL Basemap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608221#M56883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks for the reply.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In the future, I plan to make all of my web-maps the way you describe.&amp;nbsp; However, right now I already have a 8,000+ line program with a lot of hardcoded references to layer ids loaded from an ArcGIS Online Web Map.&amp;nbsp; I might have to revisit and update a significant portion of my code in the future to make my program more flexible (it would be a good idea).&amp;nbsp; But right now I just want to release this app and this is the last problem left that still bothers me, so I am looking for a quick and easy solution for now.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 17:21:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608221#M56883</guid>
      <dc:creator>DanielTrone</dc:creator>
      <dc:date>2013-05-28T17:21:17Z</dc:date>
    </item>
    <item>
      <title>Re: Hiding, Removing, or Changing AGOL Basemap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608222#M56884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Understood.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Have you tried removing the base map layer with Map#removeLayer()? &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;map.removeLayer( map.getLayer("layer0") );&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It appears that "layer0" is always the base map's layer ID, but I don't know whether that is guaranteed. I took a look at the properties of each layer, and the best one I can find for identifying the base map layer is the url property. E.g., the url for the topographical map when loaded from the public JSAPI is this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A class="jive-link-external-small" href="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" rel="nofollow" target="_blank"&gt;http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 18:09:41 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608222#M56884</guid>
      <dc:creator>BradCollins</dc:creator>
      <dc:date>2013-05-28T18:09:41Z</dc:date>
    </item>
    <item>
      <title>Re: Hiding, Removing, or Changing AGOL Basemap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608223#M56885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That was just the code I needed, but with one adjustment; instead of 'layer0', it is 'defaultBasemap' for AGOL Web Maps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 18:35:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608223#M56885</guid>
      <dc:creator>DanielTrone</dc:creator>
      <dc:date>2013-05-28T18:35:19Z</dc:date>
    </item>
    <item>
      <title>Re: Hiding, Removing, or Changing AGOL Basemap</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608224#M56886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Very good. Glad to help!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 May 2013 18:38:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/hiding-removing-or-changing-agol-basemap/m-p/608224#M56886</guid>
      <dc:creator>BradCollins</dc:creator>
      <dc:date>2013-05-28T18:38:11Z</dc:date>
    </item>
  </channel>
</rss>

