Create and move geometries to determine the spatial relationships that are satisfied.
What is a spatial relationship analysis?
A spatial relationship analysis is the process of determining the topological association between two geometries. For example, you can determine if two geometries contain, cross, overlap, cross, intersect, or touch one another. To execute the analysis, you can use ArcGIS Maps SDK for JavaScript, ArcGIS Maps SDKs for Native Apps, or ArcGIS API for Python. See the code examples below.
How to determine the spatial relationship
To determine if a spatial relationship exists between two shapes, you have to create the geometries and test for a specific type of relationship. Most client APIs have specific methods for each operation. All operations return true or false.
To determine if a spatial relationship exists:
Create two geometries with the same spatial reference.
Use an operation to test for a specific type of spatial relationship. For example, intersects.
Interior: The entire shape, except for its boundary. All geometry types have interiors.
Boundary: The endpoints of all linear parts for line features, or the linear outline of a polygon. Only polylines and polygons have boundaries.
Exterior: The outside area of a shape. All geometry types have exteriors.
If the interior, boundary, and exterior of the geometries satisfy the operation, it returns true, and the geometries support the spatial relationship.
Types of spatial relationship operations
The table below includes operations for determining common spatial relationships between two geometries. They return true or false indicating if the geometries satisfy the relation or not.
Returns true if input geometries satisfy the specified DE-9IM spatial relation. You can provide any combination of the supported DE-9IM operations.
Custom spatial relationships
You can test for a custom spatial relationship by defining your own relation. For example, you can create a relation that tests if two geometries intersect and touch. To do so, see the Relate example below.
Code examples
Contains
Determine if one geometry contains another geometry.
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)ArcGIS API for Python
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)ArcGIS API for Python
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)ArcGIS API for Python
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)ArcGIS API for Python
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)ArcGIS API for Python
Determine if one geometry is fully within another.
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)ArcGIS API for Python
Determine if the geometries satisfy a custom DE-9IM relation. The test below is for a polyline that intersects and touches the a part of the square. The test is: "FFT****".
ArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for JavaScriptArcGIS Maps SDK for .NETArcGIS Maps SDK for JavaArcGIS Maps SDK for Qt (C++)ArcGIS Maps SDK for Qt (QML)Python