<?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 Missing sublayers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/missing-sublayers/m-p/1263178#M80435</link>
    <description>&lt;P&gt;UPDATE:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I modified the script and it captures all sublayers. But is there an easier and more direct way of doing it?&lt;/P&gt;&lt;P&gt;Updated script:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  Layer.fromArcGISServerUrl({
    url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer ",
  }).then(function (layer) {
    layer.when(() =&amp;gt; {
      layer.sublayers.map((sublayer) =&amp;gt; {
        const id = sublayer.id;
        console.log(id);
        if (sublayer.sublayers) {
          sublayer.sublayers.map((sublayer1) =&amp;gt; {
            const id = sublayer1.id;
            console.log(id);
          });
        }
      });
    });
  });&lt;/LI-CODE&gt;&lt;P&gt;________________________________________________________________________________&lt;/P&gt;&lt;P&gt;Original Post&lt;/P&gt;&lt;P&gt;I am trying to get access to all sublayers. However, the sublayers&amp;nbsp; of a sublayer seems to be skipped of.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, for this REST service at:&lt;/P&gt;&lt;P&gt;&lt;A href="https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer" target="_blank" rel="noopener"&gt;https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sublayers 2&amp;nbsp; and 5 are skipped off when I run this script. It seems that sublayers of a sublayer are not detected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Layer.fromArcGISServerUrl({
    url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer ",
  }).then(function (layer) {  
    layer.when(() =&amp;gt; {
      layer.sublayers.map((sublayer) =&amp;gt; {
        const id = sublayer.id;
        console.log(id);
      });
    });
  });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_0-1677694664763.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/64063i32E5E18A9344604E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_0-1677694664763.png" alt="LefterisKoumis_0-1677694664763.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@Anonymous User&amp;nbsp;in another posting you suggested using the&amp;nbsp; method&amp;nbsp;&lt;SPAN&gt;fromArcGISServerUrl but does it has limitations on sublayers?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 01 Mar 2023 18:32:59 GMT</pubDate>
    <dc:creator>LefterisKoumis</dc:creator>
    <dc:date>2023-03-01T18:32:59Z</dc:date>
    <item>
      <title>Missing sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/missing-sublayers/m-p/1263178#M80435</link>
      <description>&lt;P&gt;UPDATE:&amp;nbsp;&lt;/P&gt;&lt;P&gt;I modified the script and it captures all sublayers. But is there an easier and more direct way of doing it?&lt;/P&gt;&lt;P&gt;Updated script:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;  Layer.fromArcGISServerUrl({
    url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer ",
  }).then(function (layer) {
    layer.when(() =&amp;gt; {
      layer.sublayers.map((sublayer) =&amp;gt; {
        const id = sublayer.id;
        console.log(id);
        if (sublayer.sublayers) {
          sublayer.sublayers.map((sublayer1) =&amp;gt; {
            const id = sublayer1.id;
            console.log(id);
          });
        }
      });
    });
  });&lt;/LI-CODE&gt;&lt;P&gt;________________________________________________________________________________&lt;/P&gt;&lt;P&gt;Original Post&lt;/P&gt;&lt;P&gt;I am trying to get access to all sublayers. However, the sublayers&amp;nbsp; of a sublayer seems to be skipped of.&amp;nbsp;&lt;/P&gt;&lt;P&gt;For example, for this REST service at:&lt;/P&gt;&lt;P&gt;&lt;A href="https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer" target="_blank" rel="noopener"&gt;https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;sublayers 2&amp;nbsp; and 5 are skipped off when I run this script. It seems that sublayers of a sublayer are not detected.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;Layer.fromArcGISServerUrl({
    url: "https://tigerweb.geo.census.gov/arcgis/rest/services/TIGERweb/Urban/MapServer ",
  }).then(function (layer) {  
    layer.when(() =&amp;gt; {
      layer.sublayers.map((sublayer) =&amp;gt; {
        const id = sublayer.id;
        console.log(id);
      });
    });
  });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Output:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LefterisKoumis_0-1677694664763.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/64063i32E5E18A9344604E/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LefterisKoumis_0-1677694664763.png" alt="LefterisKoumis_0-1677694664763.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;@Anonymous User&amp;nbsp;in another posting you suggested using the&amp;nbsp; method&amp;nbsp;&lt;SPAN&gt;fromArcGISServerUrl but does it has limitations on sublayers?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 18:32:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/missing-sublayers/m-p/1263178#M80435</guid>
      <dc:creator>LefterisKoumis</dc:creator>
      <dc:date>2023-03-01T18:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: Missing sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/missing-sublayers/m-p/1263184#M80436</link>
      <description>&lt;P&gt;You can try using layer.loadAll() and it should load all sublayers and child sublayers for you.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#loadAll" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-MapImageLayer.html#loadAll&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Oh, and Sublayers is a Collection, so you can flatten it after.&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#flatten" target="_blank"&gt;https://developers.arcgis.com/javascript/latest/api-reference/esri-core-Collection.html#flatten&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 01 Mar 2023 18:38:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/missing-sublayers/m-p/1263184#M80436</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2023-03-01T18:38:45Z</dc:date>
    </item>
  </channel>
</rss>

