<?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: Access Layer Properties for WebMap Layers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1512540#M85148</link>
    <description>&lt;P&gt;Thanks! This helped with a different timing issue I was having where the&amp;nbsp;&lt;SPAN&gt;map.allLayers.items[0].&lt;/SPAN&gt;&lt;SPAN&gt;renderer.uniqueValueInfos was coming up undefined.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 30 Jul 2024 18:45:57 GMT</pubDate>
    <dc:creator>Jeff-Reinhart</dc:creator>
    <dc:date>2024-07-30T18:45:57Z</dc:date>
    <item>
      <title>Access Layer Properties for WebMap Layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1211387#M78661</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;I've got a working webmap (JS 4.24), using an AGOL web map but I can't figure out how to access the individual layers contained in the webmap. I just want to be able to reference a specific layer so I can do things like toggle it's visibility.&lt;/P&gt;&lt;P&gt;I've tried a couple of methods (see below), but if they are working I haven't been able to find a way to then reference the layer (where do I put the &lt;EM&gt;&lt;STRONG&gt;visible: true,&lt;/STRONG&gt; &lt;/EM&gt;statement? Or the &lt;EM&gt;&lt;STRONG&gt;listMode: 'hide'&lt;/STRONG&gt; &lt;/EM&gt;statement?&lt;/P&gt;&lt;P&gt;Obviously I'm fairly new to JavaScript...&lt;/P&gt;&lt;P&gt;Is there a better way to reference a layer in a webmap?&lt;/P&gt;&lt;P&gt;Having referenced it, how do I set it's properties?&lt;/P&gt;&lt;P&gt;Any advice or suggestions appreciated,&lt;/P&gt;&lt;P&gt;thanks,&lt;/P&gt;&lt;P&gt;~stefan&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stuff I've tried:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;const webmap = new WebMap({&lt;BR /&gt;portalItem: {&lt;BR /&gt;id: "9c161033f604436193805a7484feab3d" // Web Map for JavaScript&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;const view = new MapView({&lt;BR /&gt;container: "viewDiv",&lt;BR /&gt;map: webmap,&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;// get layers when the view is initialized&lt;BR /&gt;webmap.when(() =&amp;gt; {&lt;BR /&gt;// layer 0&lt;BR /&gt;const layer0 = webmap.layers.items[0];&lt;BR /&gt;});&lt;BR /&gt;&lt;BR /&gt;// OR Find a layer by ID...&lt;BR /&gt;const layer1 = webmap.findLayerById("958f6534812a4407925a2a18a640b841");&lt;/P&gt;</description>
      <pubDate>Sat, 10 Sep 2022 22:33:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1211387#M78661</guid>
      <dc:creator>StefanFreelan</dc:creator>
      <dc:date>2022-09-10T22:33:02Z</dc:date>
    </item>
    <item>
      <title>Re: Access Layer Properties for WebMap Layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1211686#M78674</link>
      <description>&lt;P&gt;Hi there,&amp;nbsp;&lt;/P&gt;&lt;P&gt;You can loop through all operational layers in your web map after all resources are laded and find the layer you need. &amp;nbsp;The following code should get you started:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;webmap.loadAll().then(()=&amp;gt;{
  // loop through all operational layers in your webmap
  webmap.layers.forEach((layer)=&amp;gt;{
    console.log("layer.id", layer.id, layer);
    // check your layer here
  });
 });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This sample also shows how to get a layer at the specified index.&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=featureeffect-drop-shadow" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/sample-code/sandbox/?sample=featureeffect-drop-shadow&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 17:05:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1211686#M78674</guid>
      <dc:creator>UndralBatsukh</dc:creator>
      <dc:date>2022-09-12T17:05:15Z</dc:date>
    </item>
    <item>
      <title>Re: Access Layer Properties for WebMap Layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1212770#M78718</link>
      <description>&lt;P&gt;Thanks UndralBatsukh, I'll see if I can get this to work.&lt;/P&gt;</description>
      <pubDate>Thu, 15 Sep 2022 03:37:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1212770#M78718</guid>
      <dc:creator>StefanFree</dc:creator>
      <dc:date>2022-09-15T03:37:26Z</dc:date>
    </item>
    <item>
      <title>Re: Access Layer Properties for WebMap Layers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1512540#M85148</link>
      <description>&lt;P&gt;Thanks! This helped with a different timing issue I was having where the&amp;nbsp;&lt;SPAN&gt;map.allLayers.items[0].&lt;/SPAN&gt;&lt;SPAN&gt;renderer.uniqueValueInfos was coming up undefined.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jul 2024 18:45:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/access-layer-properties-for-webmap-layers/m-p/1512540#M85148</guid>
      <dc:creator>Jeff-Reinhart</dc:creator>
      <dc:date>2024-07-30T18:45:57Z</dc:date>
    </item>
  </channel>
</rss>

