4

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?

3

According to this page the spatial rel enum for intersect:

Returns a feature if any spatial relationship is found. Applies to all shape type combinations.

and for overlap:

Returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes. Applies to Area/Area, Line/Line, and Multi-point/Multi-point shape type combinations.

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 use esriSpatialRelEnum.esriSpatialRelRelation and specify the required relationship in ISpatialFilter.SpatialRelDescription for precise control over interior/exterior/boundary relationships.

1

As mentioned by @MichaelMilesStimson, for spatial queries:

INTERSECT returns a feature if any spatial relationship is found. Applies to all shape type combinations.

and for overlap:

OVERLAP returns a feature if the intersection of the two shapes results in an object of the same dimension, but different from both of the shapes.

However, I have to disagree when he says that it does not make a difference with polygons.

Intersect is true if the intersection of the two polygons is a point, a line or a polygon of any shape. It includes all types of spatial relationships (except "disjoint", of course)

Overlap is true if the intersection of two polygons is a polygon (does not include "touch") and the shape of this intersection is different from both shapes (does not include "identical", "contains" or "within"). Overlap is thus far more restrictive.

There is however an inconsistency IMHO with the topology rule "must not overlap". In this case only the first condition is considered but the intersection can be identical to one of the input shapes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.