<?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: Feature Layer with sublayers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101190#M9306</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also have this problem. While it makes sense there is a one-to-one layer mapping, is&amp;nbsp;there an easy way to discover available layers in the MapServer, and dynamically add those layers to the map, rather than having to manually add layer 0, 1 and 2? I don't mind requesting layer list from the server, and then iterating them, adding them to group layer or directly to the map; I just don't know how to query the ArcGIS&amp;nbsp;MapServer for available layers. Since I&amp;nbsp;get the url from a configuration, I'd rather avoid having to specify configuration&amp;nbsp;per layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resolution: Using a dynamic layer behind the scenes, I can iterate the Layers collection to create FeatureLayer for the layers in the MapServer, adding them to the map, while discarding the dynamic layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 17 Aug 2017 09:09:37 GMT</pubDate>
    <dc:creator>BjørnarSundsbø1</dc:creator>
    <dc:date>2017-08-17T09:09:37Z</dc:date>
    <item>
      <title>Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101188#M9304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all! &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have several layers I want to add to a map. Each layer has sublayers and an attribute table. When I was first practicing with adding layers, I made them all MapImageLayers so I could see the sublayers. Now I want to add popups that display the information in the attribute table. But when I made the layers all FeatureLayers, all of my sublayers disappeared! The FeatureLayer documentation doesn't mention children or sublayers, so I'm not sure how to get the sublayers to show back up in my LayerList widget.&amp;nbsp;Help me ArcGISPros-wan-Kenobi, you're my only hope!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 16:06:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101188#M9304</guid>
      <dc:creator>GregSalvador</dc:creator>
      <dc:date>2017-08-16T16:06:53Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101189#M9305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;A FeatureLayer is a specific layer inside a Map Service. So the url would include the specific layer ID in the MapService.&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #c41a16; background-color: #f8f8f8;"&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=https%3A%2F%2Fsampleserver6.arcgisonline.com%2Farcgis%2Frest%2Fservices%2FUSA%2FMapServer%2F" rel="nofollow" target="_blank"&gt;https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/&lt;/A&gt;&lt;STRONG&gt;0&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 16:33:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101189#M9305</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-08-16T16:33:58Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101190#M9306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I also have this problem. While it makes sense there is a one-to-one layer mapping, is&amp;nbsp;there an easy way to discover available layers in the MapServer, and dynamically add those layers to the map, rather than having to manually add layer 0, 1 and 2? I don't mind requesting layer list from the server, and then iterating them, adding them to group layer or directly to the map; I just don't know how to query the ArcGIS&amp;nbsp;MapServer for available layers. Since I&amp;nbsp;get the url from a configuration, I'd rather avoid having to specify configuration&amp;nbsp;per layer.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Resolution: Using a dynamic layer behind the scenes, I can iterate the Layers collection to create FeatureLayer for the layers in the MapServer, adding them to the map, while discarding the dynamic layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 09:09:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101190#M9306</guid>
      <dc:creator>BjørnarSundsbø1</dc:creator>
      <dc:date>2017-08-17T09:09:37Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101191#M9307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for reply Robert, it worked great. However, in my layerList widget, the FeatureLayer shows up as a separate layer. This makes sense, because I added it to the Map the same way I added all of the MapImageLayeres. I would like to replace the sublayer with the FeatureLayer, not make it seperate from its parent layer. Is there a way to do this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2017 18:39:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101191#M9307</guid>
      <dc:creator>GregSalvador</dc:creator>
      <dc:date>2017-08-18T18:39:30Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101192#M9308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;No there is not, so it is back to a MapImageLayer for you then. If you want the MapService to be one layer in the layer list with sublayers as children then you need to use MapImageLayer. So back to the question of your original intent/need. If you need to specify a popup for a sublayer of a MapImageLayer then you just assign the sublayer a specific popup.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="comment token"&gt;// Overrides the drawing info on the layer with a custom renderer&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; citiesLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;sublayers&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;getItemAt&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;3&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
citiesLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;popupTemplate &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;PopupTemplate&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp; title&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"Population in {NAME}"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt;
&amp;nbsp; content&lt;SPAN class="punctuation token"&gt;:&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"As of 2010, the population in this area was &amp;lt;b&amp;gt;{POP2010:NumberFormat}&amp;lt;/b&amp;gt;."&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"As of 2013, the population here was &amp;lt;b&amp;gt;{POP2013:NumberFormat}&amp;lt;/b&amp;gt;."&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN class="string token"&gt;"Percent change is {POP2013:populationChange}"&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:15:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101192#M9308</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T06:15:30Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101193#M9309</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Robert, this is exactly what I was looking for! This code makes a lot of sense.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Small problem, though: layer.sublayers comes back empty. This is what I have&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var BREADCADLayer = landLayer.sublayers.getItemAt(40);&lt;/P&gt;&lt;P&gt;with landLayer being a MapImageLayer that i know has sublayers. After removing the getItemAt() function and putting landLayer.sublayers.join() in a console.log, I confirmed that the collection is empty. Am i missing something here?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: I don't specify the sublayers property of landLayer in its constructor, as I want every sublayer in the MapService to be included. The only thing specified in the landLayer constructor is url.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2017 19:39:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101193#M9309</guid>
      <dc:creator>GregSalvador</dc:creator>
      <dc:date>2017-08-18T19:39:17Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101194#M9310</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;What are you doing ion your code to ensure that the layer is actually loaded before executing your code?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2017 20:16:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101194#M9310</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2017-08-18T20:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101195#M9311</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;umm, nothing really. I know the layer is loading because I can access it in layerList widget and it has sublayers. I put your code snippit at the bottom of my script, but I don't know if that guarantees that snippit gets executed last&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;edit: I should put your code snippit in something like view.then(snippit), so it load after everything is loaded?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2017 20:20:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101195#M9311</guid>
      <dc:creator>GregSalvador</dc:creator>
      <dc:date>2017-08-18T20:20:06Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101196#M9312</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Greg,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Well the layer list is going to wait for the layer to load before working with the sublsyers and you need to do the same. So &lt;SPAN style="background-color: #ffffff;"&gt;&lt;SPAN&gt;you then do:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; BREADCADLayer &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;MapImageLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
BREADCADLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;fl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
&amp;nbsp; &lt;SPAN class="comment token"&gt;//now the sublayers should not be empty&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 06:15:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101196#M9312</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-11T06:15:33Z</dc:date>
    </item>
    <item>
      <title>Re: Feature Layer with sublayers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101197#M9313</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Very cool! I certainly learned a lot here, thank you very much&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 18 Aug 2017 21:46:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-layer-with-sublayers/m-p/101197#M9313</guid>
      <dc:creator>GregSalvador</dc:creator>
      <dc:date>2017-08-18T21:46:39Z</dc:date>
    </item>
  </channel>
</rss>

