<?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: ArcGIS API 4.6 How to set opacity for the basemap? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/1134907#M75978</link>
    <description>&lt;P&gt;One more important thing to note is that you also have to wait until the view is ready and then access the basemap layer; otherwise, it will give you undefined.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.when(function(){
    console.log(map.allLayers.length);
    console.log(map.basemap.baseLayers.getItemAt(0));
    map.basemap.baseLayers.getItemAt(0).opacity = 0.6;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 19 Jan 2022 09:02:20 GMT</pubDate>
    <dc:creator>arahman_mdmajid</dc:creator>
    <dc:date>2022-01-19T09:02:20Z</dc:date>
    <item>
      <title>ArcGIS API 4.6 How to set opacity for the basemap?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/439244#M40470</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;ArcGIS API 4.6&amp;nbsp; What is the "proper" way to change opacity for the basemap?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;possibly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var map = new Map({ basemap:"topo"});&lt;/P&gt;&lt;P&gt;map.allLayers.items[0].opacity=0.25;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;or perhaps:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var map = new Map();&lt;/P&gt;&lt;P&gt;map.add( new TileLayer(&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; id:"topo",&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp; url="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fservices.arcgisonline.com%2FArcGIS%2Frest%2Fservices%2FWorld_Topo_Map%2FMapServer" rel="nofollow" target="_blank"&gt;https://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer&lt;/A&gt;&lt;SPAN&gt;"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;map.findLayerById("topo").opacity=0.25;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Appendix question: why use basemap vs TileLayer ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks and good health!&lt;/P&gt;&lt;P&gt;Blair&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:03:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/439244#M40470</guid>
      <dc:creator>BlairJones</dc:creator>
      <dc:date>2018-06-05T20:03:00Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API 4.6 How to set opacity for the basemap?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/439245#M40471</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Blair,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;You can grab the basemap layer as you have in your first code block because you can always count on the the main basemap layer being 0 index but if you are using a basemap with reference layers you will have to adjust that logic. You can use map.&lt;SPAN style="color: #4c4c4c; background-color: #ffffff; font-weight: 300;"&gt;baseLayers.forEach(layer) to set the opacity for each of the layers in the basemap. The reason you would use a basemap vs a TileLayer is mainly for the ease of coding using one line of code to set the basemap verses using a the TileLayer route.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Jun 2018 20:35:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/439245#M40471</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2018-06-05T20:35:54Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS API 4.6 How to set opacity for the basemap?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/1134907#M75978</link>
      <description>&lt;P&gt;One more important thing to note is that you also have to wait until the view is ready and then access the basemap layer; otherwise, it will give you undefined.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;view.when(function(){
    console.log(map.allLayers.length);
    console.log(map.basemap.baseLayers.getItemAt(0));
    map.basemap.baseLayers.getItemAt(0).opacity = 0.6;
});&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 Jan 2022 09:02:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-api-4-6-how-to-set-opacity-for-the-basemap/m-p/1134907#M75978</guid>
      <dc:creator>arahman_mdmajid</dc:creator>
      <dc:date>2022-01-19T09:02:20Z</dc:date>
    </item>
  </channel>
</rss>

