<?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: IdentifyTask only CURRENTLY visible layers? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86641#M7830</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I &lt;EM&gt;knew &lt;/EM&gt;it had to be easier than I thought it was.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now recall you mentioned a similar (if not exactly the same) comment on my previous question, Ken. I guess I glossed over it because I took a different direction with my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very much appreciate the help and patience! That one extra line of code did the trick (used the &lt;EM&gt;&lt;EM&gt;identifyParams.layerIds = SG_ml.visibleLayers;&lt;/EM&gt; &lt;/EM&gt;choice).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Oct 2015 18:16:20 GMT</pubDate>
    <dc:creator>alexmoore</dc:creator>
    <dc:date>2015-10-20T18:16:20Z</dc:date>
    <item>
      <title>IdentifyTask only CURRENTLY visible layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86637#M7826</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to incorporate an IdentifyTask in my JS web application that identifies layers within an ArcGISDynamicMapServiceLayer upon a "click".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have successfully integrated the function and can identify features with a click, however a popup will display whether or not that layer is toggled in the web app. I require my end users to be able to enable/disable layers they choose. If I understand correctly, LAYER_OPTION_VISIBLE will allow popups for all layers initially set to be visible in the MXD, and LAYER_OPTION_ALL will allow popups for all layers, regardless of default MXD visibility.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to only call popups when the layer is &lt;EM&gt;enabled in the web application itself&lt;/EM&gt;. I have too many layers for my users to have to sift through all of the disabled ones to find the one they are looking for.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched high and low to find a working example so the identify task is "listening" to when a layer is toggled on/off, but cannot find a sample that works for me. I am still very new to JS, this may be easier than I am making it out to be.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Below is a JS Fiddle that demonstrates the problems I am having. Had to substitute ESRI sample services due to company network restrictions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am working in NetBeans 8.0.2 BTW.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsfiddle.net/amoore4/L1w54zqg/" title="http://jsfiddle.net/amoore4/L1w54zqg/"&gt;Edit fiddle - JSFiddle&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I appreciate any and all feedback!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EDIT: as you can see below, regardless if the layer is "enabled", the popup will display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/132472_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/132479_pastedImage_1.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2015 16:42:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86637#M7826</guid>
      <dc:creator>alexmoore</dc:creator>
      <dc:date>2015-10-20T16:42:43Z</dc:date>
    </item>
    <item>
      <title>Re: IdentifyTask only CURRENTLY visible layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86638#M7827</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/identifyparameters-amd.html#layerids" rel="nofollow noopener noreferrer" target="_blank"&gt;layerIds&lt;/A&gt; property and your visibleLayerIds variable to only identify the visible layers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;function executeIdentifyTask(event) {
&amp;nbsp;&amp;nbsp;&amp;nbsp; identifyParams.layerIds = visibleLayerIds;
&amp;nbsp;&amp;nbsp;&amp;nbsp; identifyParams.geometry = event.mapPoint;
&amp;nbsp;&amp;nbsp;&amp;nbsp; identifyParams.mapExtent = map.extent;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You could also use the &lt;A href="https://developers.arcgis.com/javascript/jsapi/arcgisdynamicmapservicelayer-amd.html#visiblelayers" rel="nofollow noopener noreferrer" target="_blank"&gt;visibleLayers&lt;/A&gt; property of the layer itself&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;identifyParams.layerIds = SG_ml.visibleLayers;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:19:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86638#M7827</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-10T23:19:07Z</dc:date>
    </item>
    <item>
      <title>Re: IdentifyTask only CURRENTLY visible layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86639#M7828</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This functionality can be achieved with only 4 additional lines of code?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I only want to be able to identify on a subset of my visible layers.&amp;nbsp; As such can I perform an "and" statement where I put in an explicit list of layers and then only identify on those explicit layers when they are visible?&amp;nbsp; This is different from the scenario where you want to have all layers be identified if the end user makes the layer visible through a TOC.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2015 17:56:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86639#M7828</guid>
      <dc:creator>MichaelVolz</dc:creator>
      <dc:date>2015-10-20T17:56:17Z</dc:date>
    </item>
    <item>
      <title>Re: IdentifyTask only CURRENTLY visible layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86640#M7829</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually, it's only one additional line of code to set the layerIds. The other lines were already existing in his code. I included those to show where I added the line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://jsfiddle.net/kenbuja/L1w54zqg/1/" title="http://jsfiddle.net/kenbuja/L1w54zqg/1/"&gt;Edit fiddle - JSFiddle&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2015 17:58:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86640#M7829</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2015-10-20T17:58:32Z</dc:date>
    </item>
    <item>
      <title>Re: IdentifyTask only CURRENTLY visible layers?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86641#M7830</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I &lt;EM&gt;knew &lt;/EM&gt;it had to be easier than I thought it was.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I now recall you mentioned a similar (if not exactly the same) comment on my previous question, Ken. I guess I glossed over it because I took a different direction with my code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Very much appreciate the help and patience! That one extra line of code did the trick (used the &lt;EM&gt;&lt;EM&gt;identifyParams.layerIds = SG_ml.visibleLayers;&lt;/EM&gt; &lt;/EM&gt;choice).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 20 Oct 2015 18:16:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/identifytask-only-currently-visible-layers/m-p/86641#M7830</guid>
      <dc:creator>alexmoore</dc:creator>
      <dc:date>2015-10-20T18:16:20Z</dc:date>
    </item>
  </channel>
</rss>

