<?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 JS 4.x get all featurelayers in the map in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232123#M21654</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Justin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The sublayer class does not give you information on the type of layer (as you have already seen). But you can make one esriRequest call to the rest service to get the types of layers that form that particular map service.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=pjson" title="https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=pjson" rel="nofollow noopener noreferrer" target="_blank"&gt;https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer&lt;SPAN style="color: #ff0000;"&gt;/layers?f=pjson&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;If you do that you will get info like&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"type": "Group Layer",
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"type": "Annotation Layer",
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"type": "Feature Layer",&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 11:44:55 GMT</pubDate>
    <dc:creator>RobertScheitlin__GISP</dc:creator>
    <dc:date>2021-12-11T11:44:55Z</dc:date>
    <item>
      <title>ArcGIS JS 4.x get all featurelayers in the map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232122#M21653</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am trying to get a list of all featurelayers in the map. Currently i am looping through each layer/sublayers in the map and calling&amp;nbsp;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;createFeatureLayer() on the sublayer.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;Sometimes this returns a featurelayer as expected. other times it returns null or undefined for a group layer for example (which is fine).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;The issue i am seeing is when i do get a featurelayer back i am getting them back for RasterLayers that are in the map. if i check the featurelayer.type i do get "feature". I wasn't expecting this. Maybe this is a bug?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;Is there a way i can find all queryable layers (featurelayer) without having to further call the featurelayer.load() method to further interrogate the fields array to see if it's queryable?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #595959; background-color: #f8f8f8;"&gt;The end goal is for every layer in the map (feature or table) i am trying to provide a function to open a table or set a definition query for example.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2018 02:25:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232122#M21653</guid>
      <dc:creator>JustinCarasick</dc:creator>
      <dc:date>2018-05-22T02:25:24Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS 4.x get all featurelayers in the map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232123#M21654</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Justin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;The sublayer class does not give you information on the type of layer (as you have already seen). But you can make one esriRequest call to the rest service to get the types of layers that form that particular map service.&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=pjson" title="https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/layers?f=pjson" rel="nofollow noopener noreferrer" target="_blank"&gt;https://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer&lt;SPAN style="color: #ff0000;"&gt;/layers?f=pjson&lt;/SPAN&gt;&lt;/A&gt;&lt;SPAN style="color: #ff0000;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;If you do that you will get info like&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"type": "Group Layer",
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"type": "Annotation Layer",
&lt;PRE class="lia-code-sample line-numbers language-none"&gt;"type": "Feature Layer",&lt;/PRE&gt;&lt;/PRE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 11:44:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232123#M21654</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T11:44:55Z</dc:date>
    </item>
    <item>
      <title>Re: ArcGIS JS 4.x get all featurelayers in the map</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232124#M21655</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;this is probably the best option and probably faster than the way i'm doing it currently. thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 22 May 2018 15:17:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/arcgis-js-4-x-get-all-featurelayers-in-the-map/m-p/232124#M21655</guid>
      <dc:creator>JustinCarasick</dc:creator>
      <dc:date>2018-05-22T15:17:17Z</dc:date>
    </item>
  </channel>
</rss>

