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

Say I have an ArcGIS Server GeometryService running, and a map service containing ZIP code polygons (all ArcGIS 10.1).

I want to pass a coordinate, and have it return which ZIP code contains that coordinate. There seem to be many ways to approach "does THIS point fall within THIS polygon?", but how would I find out which polygon among them all contains a point?

In other words, there's this example where, given two points and a polygon, it will return which of the points is contained by the polygon. But what if you only know the point, and the objective is to determine which polygon?

share|improve this question
I feel like this is too easy but would Identify work? – mkennedy Jan 31 '13 at 22:42
That may just be the answer! I'll check it out... – yalestar Jan 31 '13 at 23:23

It looks like either the Query or the Identify tasks will do the trick.

I successfully adapted this sample to prototype this functionality using the ArcGIS JavaScript API:

 var qt1="http://localhost:6080/arcgis/rest/services/simple_ny_outline/MapServer/0"
    var queryTask = new esri.tasks.QueryTask(qt1);
    var query = new esri.tasks.Query();
    query.returnGeometry = true;
    query.outFields = ["*"];
    query.outSpatialReference = {"wkid":26918};

    var currentClick = null;
    dojo.connect(map, "onClick", function(evt) {;
      currentClick = query.geometry = evt.mapPoint;
      query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
      dojo.byId('messages').innerHTML = "<b>Executing Point Intersection Query...</b>";

    var firstGraphic = null;

    dojo.connect(queryTask, "onComplete", function(graphics) {
      firstGraphic = graphics.features[0];

      dojo.byId('messages').innerHTML = "<b>" + firstGraphic.attributes.COUNTY +"</b>";
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.