When you run a Query Task on the ArcGIS Server's REST Endpoint, you need to give a spatialRel
There are two spatial relationships which are quite similar: esriSpatialRelIntersects & esriSpatialRelOverlaps
The JavaScript API documentation has this to say about them:
SPATIAL_REL_INTERSECTS Part of a feature from feature class 1 is
contained in a feature from feature class 2.SPATIAL_REL_OVERLAPS Features from feature class 1 overlap features in
feature class 2.
If one is querying a Polygon featureclass by using a Polygon as an Input, what is the difference between the two?
Best Answer
According to this page the spatial rel enum for intersect:
and for overlap:
For polygons there is little to no difference between these operators, except perhaps if one is an exact copy of the other, completely contained or completely containing (I have not tested this).
The difference between these operators is only realized in line/line queries. When using intersect (
esriSpatialRelEnum.esriSpatialRelIntersects
) a line will be selected if it crosses or touches the query line(s), conversely with the overlap (esriSpatialRelEnum.esriSpatialRelOverlaps
) operator a line will only be selected with the query line(s) if it shares a segment or segments i.e. the common portion between the two geometries is a line.Theoretically the overlaps operator should not select geometries containing or within the query geometry, however I have not tested this. Normally I would use
esriSpatialRelEnum.esriSpatialRelIntersects
for spatial filters and if I require a specific relationship I useesriSpatialRelEnum.esriSpatialRelRelation
and specify the required relationship in ISpatialFilter.SpatialRelDescription for precise control over interior/exterior/boundary relationships.