<?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: Multiple ArcGISDynamicMapServiceLayer IdentifyTask in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407450#M37551</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason the ShowIdentifyResults was taking so long to display on the map was because it was creating results for all layers in each of the dynamic map service layers.&lt;/P&gt;&lt;P&gt;To only ShowIdentifyResults for the visible layers,&amp;nbsp;I modified the createIdentifyParams function with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var visLayers = layer.visibleLayers;&lt;BR /&gt; if (visLayers !== -1) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;var subLayers = [];&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;for (var i = 0; i &amp;lt; visLayers.length; i++) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subLayers.push(visLayers&lt;I&gt;);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;} // end for stmt&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;alert("idParams.layerIds=" + subLayers);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;idParams.layerIds = subLayers;&lt;BR /&gt; } else {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;idParams.layerIds = [];&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/355661_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/355662_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/355663_pastedImage_3.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 05 Jun 2017 20:35:49 GMT</pubDate>
    <dc:creator>LoriEmerson_McCormack</dc:creator>
    <dc:date>2017-06-05T20:35:49Z</dc:date>
    <item>
      <title>Multiple ArcGISDynamicMapServiceLayer IdentifyTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407445#M37546</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I used the sample cleverly written in post&amp;nbsp;&lt;A _jive_internal="true" href="https://community.esri.com/message/382158?commentID=382158#comment-382158"&gt;Identify Sample&lt;/A&gt;&amp;nbsp;and modified it by setting visible layers for only a few layers in each map service. &amp;nbsp;However, when I click on the map, the identify brings up results for all the layers I clicked on even though they are not visible in the map. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this code snippet, the &lt;SPAN&gt;layer.visibleLayers[0] =&lt;/SPAN&gt;&amp;nbsp; 0,33,38,13. &amp;nbsp;Can someone explain those results?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function mapReady(map) {&lt;BR /&gt; dojo.connect(map, "onClick", runIdentifies);&lt;BR /&gt; pointsLayer.setVisibleLayers([33]);&lt;BR /&gt; linesLayer.setVisibleLayers([38, 44]);&lt;BR /&gt; polygonsLayer.setVisibleLayers([13, 27, 53, 62, 83]);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;...&lt;/P&gt;&lt;P&gt;layers = dojo.filter(layers, function (layer) {&lt;BR /&gt; if (layer.visibleLayers[0] !== -1) {&lt;BR /&gt; return layer.getImageUrl &amp;amp;&amp;amp; layer.visible&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can someone help me understand how multiple map services are handled in the identify task? &amp;nbsp;For a single map service, the identifyParams.layerIds is set to the index values of the layers to identify. &amp;nbsp;For multiple map services, is the identifyParams.layerIds set to the &lt;STRONG&gt;map url&lt;/STRONG&gt; AND the &lt;STRONG&gt;index of the layer&lt;/STRONG&gt;? &amp;nbsp;How does the IdentifyTask know which index belongs with which map service?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 01 Jun 2017 23:04:57 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407445#M37546</guid>
      <dc:creator>LoriEmerson_McCormack</dc:creator>
      <dc:date>2017-06-01T23:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple ArcGISDynamicMapServiceLayer IdentifyTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407446#M37547</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Were those the only changes you made to the code? If not, can you post your full script?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 13:22:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407446#M37547</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2017-06-02T13:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple ArcGISDynamicMapServiceLayer IdentifyTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407447#M37548</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;lt;!--Source: ESRI User Forums: &lt;/SPAN&gt;&lt;A class="jive-link-comment-small" href="https://community.esri.com/thread/94154?commentID=382158#comment-382158"&gt;https://community.esri.com/message/382158?commentID=382158#comment-382158&lt;/A&gt;&lt;SPAN&gt; --&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt;&amp;lt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&amp;gt;&lt;BR /&gt; &amp;lt;!--The viewport meta tag is used to improve the presentation and behavior of the samples&lt;BR /&gt; on iOS devices--&amp;gt;&lt;BR /&gt; &amp;lt;meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"&amp;gt;&lt;BR /&gt; &amp;lt;title&amp;gt;Identify with Popup&amp;lt;/title&amp;gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;link rel="stylesheet" href="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fjs.arcgis.com%2F3.8%2Fjs%2Fesri%2Fcss%2Fesri.css" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.8/js/esri/css/esri.css&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;style&amp;gt;&lt;BR /&gt; html, body, #map {&lt;BR /&gt; height: 100%;&lt;BR /&gt; width: 100%;&lt;BR /&gt; margin: 0;&lt;BR /&gt; padding: 0;&lt;BR /&gt; }&lt;BR /&gt; &amp;lt;/style&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;script&amp;gt;var dojoConfig = { parseOnLoad: true };&amp;lt;/script&amp;gt;&lt;BR /&gt;&lt;SPAN&gt; &amp;lt;script src="&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fjs.arcgis.com%2F3.8%2F" rel="nofollow" target="_blank"&gt;http://js.arcgis.com/3.8/&lt;/A&gt;&lt;SPAN&gt;"&amp;gt;&amp;lt;/script&amp;gt;&lt;/SPAN&gt;&lt;BR /&gt; &amp;lt;script&amp;gt;&lt;/P&gt;&lt;P&gt;var map;&lt;BR /&gt; var identifyTask, identifyParams, idPoint;&lt;BR /&gt; var identifyResults;&lt;/P&gt;&lt;P&gt;require([&lt;BR /&gt; "esri/map", "esri/dijit/Popup", "dojo/promise/all", "dojo/domReady!"&lt;BR /&gt; ], function (&lt;BR /&gt; Map, Popup, All&lt;BR /&gt; ) {&lt;BR /&gt; var popup = new Popup({&lt;BR /&gt; fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 2), new dojo.Color([255, 255, 0, 0.25]))&lt;BR /&gt; }, dojo.create("div"));&lt;/P&gt;&lt;P&gt;map = new Map("map", {&lt;BR /&gt; basemap: "satellite",&lt;BR /&gt; center: [-117.42330, 47.751103],&lt;BR /&gt; zoom: 16,&lt;BR /&gt; infoWindow: popup&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;dojo.connect(map, "onLoad", mapReady);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//var landBaseLayer = new esri.layers.ArcGISDynamicMapServiceLayer("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fsampleserver3.arcgisonline.com%2FArcGIS%2Frest%2Fservices%2FBloomfieldHillsMichigan%2FParcels%2FMapServer" rel="nofollow" target="_blank"&gt;http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/BloomfieldHillsMichigan/Parcels/MapServer&lt;/A&gt;&lt;SPAN&gt;", { opacity: .55 });&lt;/SPAN&gt;&lt;BR /&gt; //map.addLayer(landBaseLayer);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;//var militaryLayer = new esri.layers.ArcGISDynamicMapServiceLayer("&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Fsampleserver6.arcgisonline.com%2Farcgis%2Frest%2Fservices%2FMilitary%2FMapServer" rel="nofollow" target="_blank"&gt;http://sampleserver6.arcgisonline.com/arcgis/rest/services/Military/MapServer&lt;/A&gt;&lt;SPAN&gt;", { opacity: .55 });&lt;/SPAN&gt;&lt;BR /&gt; //map.addLayer(militaryLayer);&lt;BR /&gt; //console.log(militaryLayer.declaredClass);&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;var pointsURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Figis.spokanecounty.org%2Farcgis%2Frest%2Fservices%2FPublicWorks%2FPublicWorksQueriesPoints%2FMapServer" rel="nofollow" target="_blank"&gt;http://igis.spokanecounty.org/arcgis/rest/services/PublicWorks/PublicWorksQueriesPoints/MapServer&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; var linesURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Figis.spokanecounty.org%2Farcgis%2Frest%2Fservices%2FPublicWorks%2FPublicWorksQueriesLines%2FMapServer" rel="nofollow" target="_blank"&gt;http://igis.spokanecounty.org/arcgis/rest/services/PublicWorks/PublicWorksQueriesLines/MapServer&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; var polygonsURL = "&lt;/SPAN&gt;&lt;A class="jive-link-external-small" href="https://community.esri.com/external-link.jspa?url=http%3A%2F%2Figis.spokanecounty.org%2Farcgis%2Frest%2Fservices%2FPublicWorks%2FPublicWorksQueriesPolygons%2FMapServer" rel="nofollow" target="_blank"&gt;http://igis.spokanecounty.org/arcgis/rest/services/PublicWorks/PublicWorksQueriesPolygons/MapServer&lt;/A&gt;&lt;SPAN&gt;";&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;var pointsLayer = new esri.layers.ArcGISDynamicMapServiceLayer(pointsURL, {&lt;BR /&gt; id: "pointsLayer",&lt;BR /&gt; visible: true&lt;BR /&gt; });&lt;BR /&gt; map.addLayer(pointsLayer);&lt;BR /&gt; var linesLayer = new esri.layers.ArcGISDynamicMapServiceLayer(linesURL, {&lt;BR /&gt; id: "linesLayer",&lt;BR /&gt; visible: true&lt;BR /&gt; });&lt;BR /&gt; map.addLayer(linesLayer);&lt;BR /&gt; var polygonsLayer = new esri.layers.ArcGISDynamicMapServiceLayer(polygonsURL, {&lt;BR /&gt; id: "polygonsLayer",&lt;BR /&gt; visible: true&lt;BR /&gt; });&lt;BR /&gt; map.addLayer(polygonsLayer);&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; function mapReady(map) {&lt;BR /&gt; dojo.connect(map, "onClick", runIdentifies);&lt;BR /&gt; pointsLayer.setVisibleLayers([33]);&lt;BR /&gt; linesLayer.setVisibleLayers([38, 44]);&lt;BR /&gt; polygonsLayer.setVisibleLayers([13, 27, 53, 62, 83]);&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function runIdentifies(evt) {&lt;BR /&gt; identifyResults = [];&lt;BR /&gt; idPoint = evt.mapPoint;&lt;BR /&gt; var layers = dojo.map(map.layerIds, function (layerId) {&lt;BR /&gt; return map.getLayer(layerId);&lt;BR /&gt; });&lt;BR /&gt; layers = dojo.filter(layers, function (layer) {&lt;BR /&gt; if (layer.visibleLayers[0] !== -1) {&lt;BR /&gt; alert(layer.visibleLayers[0]);&lt;BR /&gt; return layer.getImageUrl &amp;amp;&amp;amp; layer.visible&lt;BR /&gt; }&lt;BR /&gt; }); //Only dynamic layers have the getImageUrl function. Filter so you only query visible dynamic layers&lt;BR /&gt; var tasks = dojo.map(layers, function (layer) {&lt;BR /&gt; return new esri.tasks.IdentifyTask(layer.url);&lt;BR /&gt; }); //map each visible dynamic layer to a new identify task, using the layer url&lt;BR /&gt; var defTasks = dojo.map(tasks, function (task) {&lt;BR /&gt; return new dojo.Deferred();&lt;BR /&gt; }); //map each identify task to a new dojo.Deferred&lt;BR /&gt; var params = createIdentifyParams(layers, evt);&lt;/P&gt;&lt;P&gt;var promises = [];&lt;/P&gt;&lt;P&gt;for (i = 0; i &amp;lt; tasks.length; i++) {&lt;BR /&gt; promises.push(tasks&lt;I&gt;.execute(params&lt;I&gt;)); //Execute each task&lt;BR /&gt; }&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;var allPromises = new All(promises);&lt;BR /&gt; allPromises.then(function (r) { showIdentifyResults(r, tasks); });&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function showIdentifyResults(r, tasks) {&lt;BR /&gt; var results = [];&lt;BR /&gt; var taskUrls = [];&lt;BR /&gt; r = dojo.filter(r, function (result) {&lt;BR /&gt; return r[0];&lt;BR /&gt; });&lt;BR /&gt; for (i = 0; i &amp;lt; r.length; i++) {&lt;BR /&gt; results = results.concat(r&lt;I&gt;);&lt;BR /&gt; for (j = 0; j &amp;lt; r&lt;I&gt;.length; j++) {&lt;BR /&gt; taskUrls = taskUrls.concat(tasks&lt;I&gt;.url);&lt;BR /&gt; }&lt;BR /&gt; }&lt;BR /&gt; results = dojo.map(results, function (result, index) {&lt;BR /&gt; var feature = result.feature;&lt;BR /&gt; var layerName = result.layerName;&lt;BR /&gt; var serviceUrl = taskUrls[index];&lt;BR /&gt; feature.attributes.layerName = result.layerName;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;var idTemplate = new esri.InfoTemplate;&lt;BR /&gt; //var idTemplate = new esri.InfoTemplate("", "Service Url: " + serviceUrl + "&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;Layer name: " + result.layerName + "&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt; Object Id: ${OBJECTID}");&lt;BR /&gt; //feature.setInfoTemplate(idTemplate);&lt;/P&gt;&lt;P&gt;switch (layerName) {&lt;BR /&gt; case "Parcels":&lt;BR /&gt; idTemplate.setContent("&amp;lt;b&amp;gt;PID_NUM&amp;lt;/b&amp;gt;: ${PID_NUM}" +&lt;BR /&gt; "&amp;lt;/br&amp;gt;&amp;lt;b&amp;gt;owner_name:&amp;lt;/b&amp;gt; ${owner_name}");&lt;BR /&gt; idTemplate.setTitle(layerName);&lt;BR /&gt; break;&lt;BR /&gt; default:&lt;BR /&gt; idTemplate.setTitle(layerName);&lt;BR /&gt; break;&lt;/P&gt;&lt;P&gt;} // end switch stmt&lt;BR /&gt; feature.setInfoTemplate(idTemplate);&lt;/P&gt;&lt;P&gt;var resultGeometry = feature.geometry;&lt;BR /&gt; var resultType = resultGeometry.type;&lt;BR /&gt; return feature;&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;if (results.length === 0) {&lt;BR /&gt; map.infoWindow.clearFeatures();&lt;BR /&gt; } else {&lt;BR /&gt; map.infoWindow.setFeatures(results);&lt;BR /&gt; }&lt;BR /&gt; map.infoWindow.show(idPoint);&lt;BR /&gt; return results;&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;function createIdentifyParams(layers, evt) {&lt;BR /&gt; var identifyParamsList = [];&lt;BR /&gt; identifyParamsList.length = 0;&lt;BR /&gt; dojo.forEach(layers, function (layer) {&lt;BR /&gt; var idParams = new esri.tasks.IdentifyParameters();&lt;BR /&gt; idParams.width = map.width;&lt;BR /&gt; idParams.height = map.height;&lt;BR /&gt; idParams.geometry = evt.mapPoint;&lt;BR /&gt; idParams.mapExtent = map.extent;&lt;BR /&gt; idParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;&lt;BR /&gt; var visLayers = layer.visibleLayers;&lt;BR /&gt; //alert(visLayers);&lt;BR /&gt; if (visLayers !== -1) {&lt;BR /&gt; var subLayers = [];&lt;BR /&gt; for (var i = 0; i &amp;lt; layer.layerInfos.length; i++) {&lt;BR /&gt; if (layer.layerInfos&lt;I&gt;.subLayerIds == null)&lt;BR /&gt; subLayers.push(layer.layerInfos&lt;I&gt;.id);&lt;BR /&gt; }&lt;BR /&gt; idParams.layerIds = subLayers;&lt;BR /&gt; } else {&lt;BR /&gt; idParams.layerIds = [];&lt;BR /&gt; }&lt;BR /&gt; idParams.tolerance = 3;&lt;BR /&gt; idParams.returnGeometry = true;&lt;BR /&gt; identifyParamsList.push(idParams);&lt;BR /&gt; });&lt;BR /&gt; return identifyParamsList;&lt;BR /&gt; }&lt;/I&gt;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;});&lt;BR /&gt; &amp;lt;/script&amp;gt;&lt;BR /&gt; &lt;BR /&gt;&amp;lt;/head&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;body&amp;gt;&lt;BR /&gt; &amp;lt;div id="map"&amp;gt;&amp;lt;/div&amp;gt;&lt;BR /&gt; &lt;BR /&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 17:44:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407447#M37548</guid>
      <dc:creator>LoriEmerson_McCormack</dc:creator>
      <dc:date>2017-06-02T17:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple ArcGISDynamicMapServiceLayer IdentifyTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407448#M37549</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Your alert message was just showing the first item in the array of visibleLayers&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="token function"&gt;alert&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visibleLayers&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;0&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you change it to this, it will show all the visible layers in that layer&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="token function"&gt;alert&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;layer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;visibleLayers&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;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/355378_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 18:31:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407448#M37549</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-11T18:31:40Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple ArcGISDynamicMapServiceLayer IdentifyTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407449#M37550</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, that makes sense. &amp;nbsp;Thank you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why does the code then go on and take forever for the identify popup to appear? &amp;nbsp;Why does the identify popup display all layers that were clicked at a point on the map, and not just the &lt;STRONG&gt;visible layers?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 22:36:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407449#M37550</guid>
      <dc:creator>LoriEmerson_McCormack</dc:creator>
      <dc:date>2017-06-02T22:36:47Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple ArcGISDynamicMapServiceLayer IdentifyTask</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407450#M37551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The reason the ShowIdentifyResults was taking so long to display on the map was because it was creating results for all layers in each of the dynamic map service layers.&lt;/P&gt;&lt;P&gt;To only ShowIdentifyResults for the visible layers,&amp;nbsp;I modified the createIdentifyParams function with this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var visLayers = layer.visibleLayers;&lt;BR /&gt; if (visLayers !== -1) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;var subLayers = [];&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;for (var i = 0; i &amp;lt; visLayers.length; i++) {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;subLayers.push(visLayers&lt;I&gt;);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;} // end for stmt&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;alert("idParams.layerIds=" + subLayers);&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;idParams.layerIds = subLayers;&lt;BR /&gt; } else {&lt;BR /&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;idParams.layerIds = [];&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/355661_pastedImage_1.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/355662_pastedImage_2.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/355663_pastedImage_3.png" style="width: auto; height: auto;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 05 Jun 2017 20:35:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/multiple-arcgisdynamicmapservicelayer-identifytask/m-p/407450#M37551</guid>
      <dc:creator>LoriEmerson_McCormack</dc:creator>
      <dc:date>2017-06-05T20:35:49Z</dc:date>
    </item>
  </channel>
</rss>

