Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can you figure out what polygon is clicked within a feature layer? I have a feature layer made of county polygons. When the layer is clicked I want to trigger a geoprocessing task on my server. One of the inputs to the task is a polygon. I can't figure out how to get the clicked polygon data from the onclick event.

This is my attempt at starting but can't figure out how to get the polygon from evt.

 gp = new Geoprocessor("http://myserver/arcgis/services/IntersectSumJoin/GPServer/Model");
        gp.setOutputSpatialReference({ wkid: 4326 });

        paCounties.on("click", getData);

        function getData(evt) {
            console.log("In GetData The Event graphic is "+evt.Graphic+"Point is ", evt.mapPoint.x)


The output in console is this.

I can't find a good sample that captures the Polygon in which the user clicks.

In GetData The Event graphic is undefinedPoint is -8619169.218412401

share|improve this question
I've both answered and voted down this question. Have you even tried to google or look at the ESRI samples? You need to put in a little more effort before asking a question like this. – CLJ Sep 13 '13 at 2:48
@CLJ I actually did research this for a couple hours. I did come across a few examples that showed identify and query but I kept thinking there had to be a function I was missing for a feature layer. When you click a polygon in a feature layer it outlines and gives you the data for that polygon without doing a query or identify. I was thinking there was something like paCounties.getSelectedPolygon that I was missing but apparently not. – Xaxum Sep 17 '13 at 19:54
up vote 1 down vote accepted

See this example of what you are looking for:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.