Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Not just the polygon id, you could get any parameter from a map service by doing this...</p> <p>1)Create a new IdentifyTask() by passing the MapService as the parameter.</p> <pre><code>identifyTask = new esri.tasks.IdentifyTask("&lt;Map Service URL should go here&gt;"); </code></pre> <p>2)Create a new IdentifyParameters() and set the following attributes.</p> <pre><code>identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 2; identifyParams.returnGeometry = true; identifyParams.layers = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.layerIds = [0,1,2,3,4]; identifyParams.sr=map.spatialreference; identifyParams.width = map.width; identifyParams.height = map.height; </code></pre> <p>3) A method should be invoked upon mouse click. You can do that like</p> <pre><code>dojo.connect(map, "onClick", uponClick); </code></pre> <p>4) When a polygon is clicked, uponClick() method will be called. Inside the uponClick() method, call the identifyTask.execute by passing identifyParams as parameter.</p> <pre><code>function uponClick(evt){ identifyParams.geometry = evt.mapPoint; identifyParams.mapExtent = map.extent; identifyTask.execute(identifyParams, function(result) { for(var i=0; i&lt;result.length; i++){ polyId=result[i].feature.attributes["UNIQPOLYID"]; }//end of for });//end of execute }//end of uponClick </code></pre> <p>UNIQPOLYID is one of those methods that the map service would return.</p> <p>You could find a detailed sample at this link</p> <p><a href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/find_drilldown.html" rel="nofollow">http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/find_drilldown.html</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload