<?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: How to get a layer in the map using layer name? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37355#M3108</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert, can you use a selection geometry with a QueryTask?&amp;nbsp; Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 18 Jun 2019 14:01:17 GMT</pubDate>
    <dc:creator>GarryStewart</dc:creator>
    <dc:date>2019-06-18T14:01:17Z</dc:date>
    <item>
      <title>How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37345#M3098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I'm working with the javascript 3.2 api, and have a map that loads from a pre-defined web map. &amp;nbsp; I'm now wanting to get a handle to a layer in the map using the layer name. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've managed to write some javacript code that locates the layerInfo for the said layer, but I have no idea how to get the actual layer from the map.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;_getFeatureLayer:&amp;nbsp;&lt;SPAN style="color: blue;"&gt;function&lt;/SPAN&gt;(layerName)&amp;nbsp;{ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;layer;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;SPAN style="color: blue;"&gt;for&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;j&amp;nbsp;=&amp;nbsp;0,&amp;nbsp;jl&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.map.layerIds.length;&amp;nbsp;j&amp;nbsp;&amp;lt;&amp;nbsp;jl;&amp;nbsp;j++) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
{ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;currentLayerName&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.map.layerIds&lt;J&gt;; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;currentLayer&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;.map.getLayer(currentLayerName);   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt;&amp;nbsp;(currentLayer.layerInfos.length&amp;nbsp;&amp;gt;&amp;nbsp;0)&amp;nbsp;
   { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      layer&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;this&lt;/SPAN&gt;._findSubLayerByName(currentLayer,&amp;nbsp;layerName); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      &lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt;&amp;nbsp;(layer&amp;nbsp;!=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;null&lt;/SPAN&gt;)&amp;nbsp;
      { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
         &lt;SPAN style="color: blue;"&gt;break&lt;/SPAN&gt;; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
}
&lt;SPAN style="color: blue;"&gt;return&lt;/SPAN&gt;&amp;nbsp;layer; 
},   

_findSubLayerByName:&amp;nbsp;&lt;SPAN style="color: blue;"&gt;function&lt;/SPAN&gt;&amp;nbsp;(parentLayer,&amp;nbsp;subLayerName) 
{ &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;layer;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &lt;SPAN style="color: blue;"&gt;for&lt;/SPAN&gt;&amp;nbsp;(&lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;j&amp;nbsp;=&amp;nbsp;0,&amp;nbsp;jl&amp;nbsp;=&amp;nbsp;parentLayer.layerInfos.length;&amp;nbsp;j&amp;nbsp;&amp;lt;&amp;nbsp;jl;&amp;nbsp;j++) &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      &lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;layerInfo&amp;nbsp;=&amp;nbsp;parentLayer.layerInfos&lt;J&gt;;   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      &lt;SPAN style="color: blue;"&gt;if&lt;/SPAN&gt;&amp;nbsp;(layerInfo.name&amp;nbsp;==&amp;nbsp;subLayerName)&amp;nbsp;
      { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
         /* &lt;SPAN style="color: green;"&gt;The&amp;nbsp;correct&amp;nbsp;layer&amp;nbsp;is&amp;nbsp;located,&amp;nbsp;but&amp;nbsp;how&amp;nbsp;do&amp;nbsp;I&amp;nbsp;actually&amp;nbsp;get&amp;nbsp;the&amp;nbsp;layer,&amp;nbsp;this&amp;nbsp;does&amp;nbsp;not&amp;nbsp;work.&amp;nbsp;*/
&lt;/SPAN&gt;  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: blue;"&gt;var&lt;/SPAN&gt;&amp;nbsp;subLayerUrl&amp;nbsp;=&amp;nbsp;parentLayer.url&amp;nbsp;+&amp;nbsp;&lt;SPAN style="color: #a31515;"&gt;"/"&lt;/SPAN&gt;&amp;nbsp;+&amp;nbsp;j; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
         layer&amp;nbsp;=&amp;nbsp;&lt;SPAN style="color: blue;"&gt;new&lt;/SPAN&gt;&amp;nbsp;FeatureLayer(subLayerUrl); /* This doesn't give me the layer that is already added to the map */ 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;SPAN style="color: blue;"&gt;break&lt;/SPAN&gt;; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
      } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   }   &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
   &lt;SPAN style="color: blue;"&gt;return&lt;/SPAN&gt;&amp;nbsp;layer; 
}&lt;/J&gt;&lt;/J&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 21:26:48 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37345#M3098</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2021-12-10T21:26:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37346#M3099</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;You should return your feature layer inside your for loop:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;_findSubLayerByName&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;parentLayer&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; subLayerName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
&lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;     
   &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; layer&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;       
   &lt;SPAN class="keyword token"&gt;for&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; j &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="number token"&gt;0&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; jl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parentLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerInfos&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;length&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; j &lt;SPAN class="operator token"&gt;&amp;lt;&lt;/SPAN&gt; jl&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; j&lt;SPAN class="operator 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="keyword token"&gt;var&lt;/SPAN&gt; layerInfo &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parentLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;layerInfos&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;j&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;           
      &lt;SPAN class="keyword token"&gt;if&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layerInfo&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;==&lt;/SPAN&gt; subLayerName&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; 
      &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;             
         &lt;SPAN class="comment token"&gt;/* The correct layer is located, but how do I actually get the layer, this does not work. */&lt;/SPAN&gt;
         &lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; subLayerUrl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; parentLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;url &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;"/"&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;+&lt;/SPAN&gt; j&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;                          
         layer &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;FeatureLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;subLayerUrl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt; &lt;SPAN class="comment token"&gt;/* This doesn't give me the layer that is already added to the map */&lt;/SPAN&gt; 
         &lt;SPAN class="keyword token"&gt;return&lt;/SPAN&gt; layer&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="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;/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>Fri, 10 Dec 2021 21:26:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37346#M3099</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-10T21:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37347#M3100</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate your input, however that doesn't answer why I am not getting the feature layer that has already been added to the map.&amp;nbsp; The break statement causes the code to exit the loop and the return at the end does return the "new" feature layer, but not the one that's currently in the map.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The return statement is the last thing to happen in my code, as it is best practice in programming to have only one exit point from a function. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any other thoughts on how to get a layer that is in the map using layer name or layerInfo for that matter?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks so much.&lt;/P&gt;&lt;P&gt;Garry&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jun 2019 19:54:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37347#M3100</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2019-06-17T19:54:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37348#M3101</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;Are you saying that you have a Feature Layer added to your map already that would be the same as the sublayer of the ArcGISDynamicMapServiceLayer you are searching in?... Just cause you have a&amp;nbsp;&lt;SPAN class="" style="color: #000000;"&gt;ArcGISDynamicMapServiceLayer added to the map does not mean that there is a FeatureLayer created&amp;nbsp;in the map for each of it's sublayers.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jun 2019 20:02:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37348#M3101</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-06-17T20:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37349#M3102</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;Hi Robert, again thank you so much for your fast reply.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;We are serving a web map through portal, and so the web app builder is using the portal url and web map id to load the map into the web application (map viewer). &amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;I can access individual feature layers on the map using the url and adding the id number of the layer ...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;&lt;A href="https://gisserver.domain.com/secure/rest/services/MyCustomMap/MapServer/0"&gt;https://gisserver.domain.com/secure/rest/services/MyCustomMap/MapServer/0&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;I know this because I previously used the LocalLayers widget to explicitly load individual FeatureLayers from the map service using the above url syntax... and my map loaded fine and we were able to interact with the feature layers.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;However, I don't want to have to predefine my layers in configuration.&amp;nbsp; I simply want the map in portal to open in my web application.&amp;nbsp; And then be able to find a layer in that loaded map using the layer name.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;Was hoping for something simple like this.map.getLayer("LayerNameHere") but it seems this gets only the first level layers. &amp;nbsp; Anything nested requires a recursive loop like I do in my code. &amp;nbsp; Or at least that's what I think is required.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;SPAN style="font-family: arial,helvetica,sans-serif; font-size: 15px;"&gt;Thanks again, I'm pretty green with this ..&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;P style="margin-bottom: .0001pt;"&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jun 2019 20:16:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37349#M3102</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2019-06-17T20:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37350#M3103</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;OK. Let me break in down for you then. When you add a url like&amp;nbsp;&lt;A class="unlinked"&gt;https://gisserver.domain.com/secure/rest/services/MyCustomMap/MapServer to your web map that layer is added as a dynamic layer (&lt;SPAN style="color: #3d3d3d; background-color: #ffffff;"&gt;ArcGISDynamicMapServiceLayer) which is just an image that is returned from&amp;nbsp;ArcGIS Server. The client&amp;nbsp;does not add individual sublayers to the map it just adds the image from the server to the map. So though you may see the sublayers shown in the map it is just an image.&amp;nbsp;&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Jun 2019 20:28:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37350#M3103</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-06-17T20:28:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37351#M3104</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you Robert, I appreciate your patience and expertise. &amp;nbsp; It sounds like we may have to load an initial map, and then add explicit FeatureLayers to the loaded map, so we can interact with them performing feature selection and highlighting, etc.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 13:11:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37351#M3104</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2019-06-18T13:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37352#M3105</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;No not really. You can just use the sublayer url like you were getting and use a QueryTask to query that layer and add a GraphicsLayer to the map to show the selection/highlight of features from that layer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 13:20:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37352#M3105</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-06-18T13:20:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37353#M3106</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert.&amp;nbsp; I took a look at the code and see it is using the jimu.js SelectionManager.js class, which uses a the geometry engine and a feature layer to locate features, and then as you said adds a graphics layer for the selection results. &amp;nbsp; So yes, we should be able to just new a FeatureLayer on the fly with the url, and run the select which should add a graphics layer on top of the map image and still give us access to individual features if needed. &amp;nbsp; I'm pretty green to this, so I apologize if I'm rambling nonsense. &amp;nbsp; I appreciate your assistance greatly.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 13:43:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37353#M3106</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2019-06-18T13:43:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37354#M3107</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Garry,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;But the use of a FeatureLayer and/or SelectionManager.js is not needed either. Once you have your sublayer url you can execute a queryTask on that url and never have to use a FeatureLayer(FL), since the results of a QueryTask can return the queried features geometry and you can add that geometry to a GraphicsLayer(GL) and add that GL to your map and now you have highlighted features in the map and not had to use a FL at all.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 13:58:35 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37354#M3107</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2019-06-18T13:58:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37355#M3108</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robert, can you use a selection geometry with a QueryTask?&amp;nbsp; Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 14:01:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37355#M3108</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2019-06-18T14:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to get a layer in the map using layer name?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37356#M3109</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Nevermind, that was a dumb question … of course you can that's what a GIS is all about.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 18 Jun 2019 14:05:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/how-to-get-a-layer-in-the-map-using-layer-name/m-p/37356#M3109</guid>
      <dc:creator>GarryStewart</dc:creator>
      <dc:date>2019-06-18T14:05:15Z</dc:date>
    </item>
  </channel>
</rss>

