sailitang

Spatial query's problem

Discussion created by sailitang on Oct 17, 2013
Latest reply on Oct 18, 2013 by JGravois-esristaff
Hi,

   I would like to identify if a point is in my map, so I am using spatial query. This is my code. I am sure this point is in my map and its coordiates are xy coordinates. I just want to test my code, but I cannot get feat.features.length's value. I used Quick watch which said "feat undefined". Could you tell me what is wrong on my code? Thanks.

var queryTask = new esri.tasks.QueryTask("http://swv25arcgist01:6080/arcgis/rest/services/WFRS/WFRS_GISConverter/MapServer/4");
                    var objquery = 0;
                    var query = new esri.tasks.Query();
                    query.returnGeometry = true;
                    query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
                    query.geometry = new Point(2617213.31, 7485938.17);
                    queryTask.execute(query, function (feat) {
                        objquery = feat.features.length;
                    });

alert(objquery);
Saili

Outcomes