Is there a way to limit results of the esriRequest query below to extents of the area of interest?
var qrequest = esriRequest({
url: test_url,
content: {
where: "objectid > 0",
returnGeometry: true,
outFields: "name",
outSR: configuration.wkid,
f: "json"
},
handleAs: "json",
callbackParamName: 'callback'
});One way I can think of would be iterating through the returned feature set and checking which ones intersect the extent, but I would prefer to have this done server side, as these feature sets could be quite large.
Solved! Go to Solution.
I recommend you to use QueryTask Object, but if you want to use esriRequest, you can specify a spatial clause using geometryType and geometry params
geometryType=esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
var qrequest = esriRequest({
url : test_url,
content : {
where : "objectid > 0",
returnGeometry : true,
outFields : "name",
outSR : configuration.wkid,
geometryType: "esriGeometryEnvelope",
geometry: "<xmin>,<ymin>,<xmax>,<ymax>"
f : "json"
},
handleAs : "json",
callbackParamName : 'callback'
});Regards
Maybe you have reasons for not using it but esri/tasks/query has a geometry option for evaluating intersects.
Vygintas,
You should use QueryTask instead, to enable you to specify a geometry to limit the query.
I recommend you to use QueryTask Object, but if you want to use esriRequest, you can specify a spatial clause using geometryType and geometry params
geometryType=esriGeometryEnvelope&geometry=<xmin>,<ymin>,<xmax>,<ymax>
var qrequest = esriRequest({
url : test_url,
content : {
where : "objectid > 0",
returnGeometry : true,
outFields : "name",
outSR : configuration.wkid,
geometryType: "esriGeometryEnvelope",
geometry: "<xmin>,<ymin>,<xmax>,<ymax>"
f : "json"
},
handleAs : "json",
callbackParamName : 'callback'
});Regards
Nice to know it's possible. Is there any scenario you can think of where esriRequest would be the better solution over queryTask?