<?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 Abstraction for index numbers to select specific feature layers in a mapservice in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278933#M25731</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If an MXD is modified, the index number for a layer in a mapservice may change since it just a relative number derived from the order in which the layers were added to an MXD. When that happens, the developer needs to track down all relevant code that specifies that index number and correct the index number to new modified index number.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a different method that does not use index numbers to specify the layer desired from a mapservice?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 26 Aug 2013 16:10:20 GMT</pubDate>
    <dc:creator>BrianPangtay</dc:creator>
    <dc:date>2013-08-26T16:10:20Z</dc:date>
    <item>
      <title>Abstraction for index numbers to select specific feature layers in a mapservice</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278933#M25731</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;If an MXD is modified, the index number for a layer in a mapservice may change since it just a relative number derived from the order in which the layers were added to an MXD. When that happens, the developer needs to track down all relevant code that specifies that index number and correct the index number to new modified index number.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there a different method that does not use index numbers to specify the layer desired from a mapservice?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Aug 2013 16:10:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278933#M25731</guid>
      <dc:creator>BrianPangtay</dc:creator>
      <dc:date>2013-08-26T16:10:20Z</dc:date>
    </item>
    <item>
      <title>Re: Abstraction for index numbers to select specific feature layers in a mapservice</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278934#M25732</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;This is currently listed as "under consideration" on the ideas site.&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://ideas.arcgis.com/ideaView?id=08730000000brPPAAY" rel="nofollow noopener noreferrer" target="_blank"&gt;http://ideas.arcgis.com/ideaView?id=08730000000brPPAAY&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you need to make a lot of updates when map services change, you can try creating a dictionary of layers to indexes.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You'd basically do a request for the map service data&lt;/SPAN&gt;&lt;BR /&gt;&lt;A href="http://gisserver:6080/arcgis/rest/services/MyService/MapServer?f=json" rel="nofollow noopener noreferrer" target="_blank"&gt;http://gisserver:6080/arcgis/rest/services/MyService/MapServer?f=json&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Iterate over the results like so,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;var indexLayers = {},
&amp;nbsp;&amp;nbsp;&amp;nbsp; layers = result.layers;
for (var i = 0, len = layers.length;, i &amp;lt; len, i++) {
&amp;nbsp; var layer = layers&lt;I&gt;;
&amp;nbsp; indexLayers[layer.name] = layer.id;&amp;nbsp; 
}
// now you can use indexLayers in your app to do the correct referencing
// when needed

layer.setVisibleLayers([indexLayers.Parcels, indexLayers['Building Footprints']]);&lt;/I&gt;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 13:34:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278934#M25732</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-12-11T13:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Abstraction for index numbers to select specific feature layers in a mapservice</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278935#M25733</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;That is what I was looking for. Is there an example online with source code that implements that method?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for the info.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Aug 2013 14:24:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278935#M25733</guid>
      <dc:creator>BrianPangtay</dc:creator>
      <dc:date>2013-08-27T14:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: Abstraction for index numbers to select specific feature layers in a mapservice</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278936#M25734</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I've have worked around this by having my server-side code supply the layer id to my client-side code.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In my situation I'm using java/spring on the server, so I have a "layer" object (a bean) which contains some properties such as the map service layer id and this object is configured via xml.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It's not perfect in that if the map service layer id does change I need to change the property in the xml configuration, but other than that it doesn't require any code changes.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Aug 2013 00:42:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/abstraction-for-index-numbers-to-select-specific/m-p/278936#M25734</guid>
      <dc:creator>TimCollyer</dc:creator>
      <dc:date>2013-08-28T00:42:33Z</dc:date>
    </item>
  </channel>
</rss>

