<?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 BUG? .visibleLayers returns group layeys in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137297#M12756</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I *think* this may be a bug, but please be kind if it isn't.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Map Service with sublayers in groups - defined in the ArcMap MXD.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because&lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/49289-IdentifyParameters.LAYER_OPTION_VISIBLE-still-gives-identify-results-on-all-layers?highlight=LAYER_OPTION_VISIBLE"&gt; &lt;/A&gt;&lt;SPAN&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN style="color:#333333;"&gt;&lt;A href="http://forums.arcgis.com/threads/49289-IdentifyParameters.LAYER_OPTION_VISIBLE-still-gives-identify-results-on-all-layers?highlight=LAYER_OPTION_VISIBLE"&gt;IdentifyParameters.LAYER_OPTION_VISIBLE doesn't work&lt;/A&gt; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;P&gt;&lt;/P&gt;I use &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt; identifyParams.layerIds = dynamicMapServiceLayer.visibleLayers;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However the first time this is run, the array returned by dynamicMapServiceLayer.visibleLayers contains group0 layer IDs - this causes the ID task to return very odd results.&amp;nbsp; Several results are repeated (I've check the JSON in Fiddler and this is in the actual returned data, not a code glitch on my side)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a layer has been switched on (or off) the returned array by dynamicMapServiceLayer.visibleLayers returns just the real sublayers - not the group Ids and the Id task works fine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alas, this is an internal service so I can't provide the links&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2012 12:52:40 GMT</pubDate>
    <dc:creator>AdrianMarsden</dc:creator>
    <dc:date>2012-10-11T12:52:40Z</dc:date>
    <item>
      <title>BUG? .visibleLayers returns group layeys</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137297#M12756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I *think* this may be a bug, but please be kind if it isn't.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have a Map Service with sublayers in groups - defined in the ArcMap MXD.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Because&lt;/SPAN&gt;&lt;A href="http://forums.arcgis.com/threads/49289-IdentifyParameters.LAYER_OPTION_VISIBLE-still-gives-identify-results-on-all-layers?highlight=LAYER_OPTION_VISIBLE"&gt; &lt;/A&gt;&lt;SPAN&gt;&lt;P align="left"&gt;&lt;/P&gt;&lt;/SPAN&gt;&lt;SPAN style="color:#333333;"&gt;&lt;A href="http://forums.arcgis.com/threads/49289-IdentifyParameters.LAYER_OPTION_VISIBLE-still-gives-identify-results-on-all-layers?highlight=LAYER_OPTION_VISIBLE"&gt;IdentifyParameters.LAYER_OPTION_VISIBLE doesn't work&lt;/A&gt; &lt;/SPAN&gt;&lt;SPAN&gt;&lt;P&gt;&lt;/P&gt;I use &lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE __default_attr="plain" __jive_macro_name="code" class="jive_macro_code jive_text_macro"&gt; identifyParams.layerIds = dynamicMapServiceLayer.visibleLayers;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;However the first time this is run, the array returned by dynamicMapServiceLayer.visibleLayers contains group0 layer IDs - this causes the ID task to return very odd results.&amp;nbsp; Several results are repeated (I've check the JSON in Fiddler and this is in the actual returned data, not a code glitch on my side)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After a layer has been switched on (or off) the returned array by dynamicMapServiceLayer.visibleLayers returns just the real sublayers - not the group Ids and the Id task works fine&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Alas, this is an internal service so I can't provide the links&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 12:52:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137297#M12756</guid>
      <dc:creator>AdrianMarsden</dc:creator>
      <dc:date>2012-10-11T12:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? .visibleLayers returns group layeys</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137298#M12757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The granularity of visibility in ArcMap applies to branch (group) and leaf nodes in the layer hierarchy; both variations of node are of type layer, so to me it makes sense that visibleLayers contains both group layers and 'leaf' layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Try calling Identify without setting the layerIds property - still see duplicates?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 13:26:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137298#M12757</guid>
      <dc:creator>__Rich_</dc:creator>
      <dc:date>2012-10-11T13:26:38Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? .visibleLayers returns group layeys</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137299#M12758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Without setting layerIds works fine, but then it doesn't honour the visible layers.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I agree, it makes sense that you get the group IDs back, what doesn't make sense is that after you make a change from the default visibility , the dynamiclayer.visibleLayers returns an array without these in, which is what I want, but if i knew it ALWAYS returned the group Ids I could code them out until LAYER_OPTION_VISIBLE is fixed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ACM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 13:30:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137299#M12758</guid>
      <dc:creator>AdrianMarsden</dc:creator>
      <dc:date>2012-10-11T13:30:09Z</dc:date>
    </item>
    <item>
      <title>Re: BUG? .visibleLayers returns group layeys</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137300#M12759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;For info, whilst I still think this is a potential bug, until LAYER_OPTION_VISIBLE is fixed, I'm calling my own function to get visible layers excluding group layers - especially as I agree &lt;/SPAN&gt;&lt;SPAN style="color: #444444; font-family: Verdana;"&gt;dynamicMapServiceLayer.visibleLayers should return all layers, including group ones, so if it is a bug, it works to start with then breaks, but currently breaks in my favour.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function getVisibleLayers() {&amp;nbsp;&amp;nbsp;&amp;nbsp; var visibleLayers = [];
&amp;nbsp;&amp;nbsp;&amp;nbsp; var items = dojo.map(dynamicMapServiceLayer.layerInfos, function (info, index) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; layerID = info.id;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (info.visible &amp;amp;&amp;amp; !info.subLayerIds) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; visibleLayers.push(layerID)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }); return visibleLayers
}&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;ACM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 07:37:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/bug-visiblelayers-returns-group-layeys/m-p/137300#M12759</guid>
      <dc:creator>AdrianMarsden</dc:creator>
      <dc:date>2021-12-11T07:37:39Z</dc:date>
    </item>
  </channel>
</rss>

