AnsweredAssumed Answered

Use Geometry Filter as Query Filter for Query Task

Question asked by camirvine on Feb 27, 2012
Latest reply on Mar 2, 2012 by DSwingley-esristaff

In the REST query operation you are able to filter the geometry to a point so that the query only takes place at that location.  I want to be able to do the same with the javascript api so that I can return the results of a field of a polygon at a specific point.  I don't want to use a map for this but just return the text of the field.  I have tried to
use this example and modify it but without any success.

This is probably due in large part to my lack of javascript knowledge!  The plan is to pass in the XY location via url into the queryfilter which I believe I have working its just the actual query task that I am unsure about.

So I have taken the same code as the 'no map' example above and just changed the query part (see below).  I am sure I need to do something more with the geometry point but I can't find any examples in code.

Any help with this would be much appreciated!


 //build query task          myQueryTask = new esri.tasks.QueryTask("http://thgistest01/ArcGIS/rest/services/PollingDistrict/MapServer/1");          //Can listen for onComplete event to process results or can use the callback option in the queryTask.execute method.         //dojo.connect(queryTask, "onComplete", showResults);          //build query filter         myQuery = new esri.tasks.Query();   new esri.geometry.Point ([x,y], new esri.SpatialReference({ wkid: sr }));   mQuery.returnGeometry = "true";   myQuery.outFields = ["Polling_Station_UPRN", "District_Code"];   myQueryTask.execute(myQuery,showResults);