intersect grids count is not matching

1092
1
09-20-2016 02:17 AM
veenahosur1
New Contributor II

function loadSearch(districtname) {
queryTask = new esri.tasks.QueryTask("http://************/arcgis/rest/services/DEMO/KGISV1/MapServer/2");
query = new esri.tasks.Query();
query.where = "DistrictName = '" + districtname + "'";
query.returnGeometry = true;
//query.geometryPrecision = 1;
queryTask.execute(query);
dojo.connect(queryTask, "onComplete", zoomToZip);
// dojo.connect(queryTask, "onComplete", zoomToZip2);
// dojo.connect(queryTask, "onComplete", zoomToZip3);
}

function zoomToZip(featureSet) {
var polygon = featureSet.features[0].geometry;
// populate the Geometry cache by calling getExtent()
//var polygon
//for (var i = 0; i < featureSet.features.length; i++) {

// polygon=featureSet.features
//}
//alert(polygon.geometry.type);
var polygonExtent = polygon.getExtent();

alert(polygonExtent);
queryTask2 = new esri.tasks.QueryTask("http://************/arcgis/rest/services/DEMO/GraticulesV1/MapServer/0");
query2 = new esri.tasks.Query();
query2.geometry = polygonExtent;
query2.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS;
query2.returnGeometry = true;
query2.outFields = ["*"];
queryTask2.execute(query2);
dojo.connect(queryTask2, "onComplete", selectTracts);
}

from first query i am getting extent of district .this geometry i am passing to second query.i am getting the output but intersected grids count is more compared to arcmap desktop.can any one tell me what is the problem

Tags (2)
0 Kudos
1 Reply
RobertScheitlin__GISP
MVP Emeritus

Veena,

   Are you sure that intersects is what you want then? What about using SPATIAL_REL_CONTAINS?

0 Kudos