A spatial relationship is only applied to geometry values. A spatial relationship returns true if the geometries have the specified relationship.
When searching the primary geometry of class objects, a spatial index is used to quickly identify the objects that pass the relationship (if the geometry is not being modified by a built-in function.)
Any type of geometry can be passed to a spatial relationship check, and only the geometry types relevant to this spatial relationship will be considered tested.
Some spatial relationships are subsets of others, for example: Covered By is a subset of Within (that is, if a geometry is Covered By another geometry, it is also Within that geometry.)
The detailed description of each of the spatial relationships uses the terms interior, boundary, exterior. The definitions of these points, lines, and areas are described below. For multi-part geometries, the description of interior and boundary is the union of the interiors and boundaries of all the parts.
Point geometry
A point is a 0-dimensional geometry that has an interior and an exterior, but no boundary.
Line geometry
A line is a 1-dimensional geometry that has an exterior, an interior, and a boundary. As the boundary is at the end points of a line, if the line is a closed ring, there is no boundary.
Area geometry
An area is a 2-dimensional geometry that has an exterior, an interior, and a boundary.
Beyond
Beyond checks that at the closest point, two geometries are at least a specified distance apart (in dataset units, which will be decimal degrees for latitude/longitude.)
Contains
A geometry contains another geometry when one object’s boundary and interior are inside another. If the boundaries intersect then it is not contained; that is dealt with by the Covered By relationship. Contains is the reciprocal relationship to Within.
The types of geometries that can contain another are:
Area-to-area
Area-to-line
Area-to-point
Line-to-line
Point-to-point
The following example shows Contains relationships, boundaries not touching:
Within relationship, boundaries touching:
Covered By
A Covered By relationship occurs when a geometry’s boundary and interior are inside a containing geometry and the boundary of the geometries intersect. Covered By is the reciprocal relationship to Covers. The types of geometries which can be covered by another are:
· Area-to-area
· Area-to-line
· Line-to-line
A geometry which lies entirely on the boundary of another geometry is not covered by that geometry.
Covers
A geometry covers another geometry when one object's interior is inside another and their boundaries intersect.
Covers is the reciprocal relationship to Covered By. The types of geometries, which can cover another are:
· Area-to-area
· Area-to-line
· Line-to-line
Cross
Two geometries cross when a line runs across the boundary of an area or the interior of another line. The types of geometries which can cross are:
· Area-to-line, when the geometry meets both the interior and exterior of the area
· Line-to-line, when the two lines meet at 0-D.
Disjoint
A Disjoint checks that the two geometries are completely disjoint: neither the boundary nor the interiors intersect.
Equal
Two geometries are equal when they have the same interior, boundary and exterior. To be equal the geometries do not need to have the same number of vertices, and lines do not need to have the same direction. The types of geometries which can be equal are:
· Area-to-area
· Line-to-line
· Point-to-point
Intersect
Intersect checks that either the boundaries or interiors of the two geometries intersect. All of the following are used to determine an intersect relationship:
· Equal
· Touch
· Overlap
· Cross
· Within
· Contains
Overlap
Two geometries overlap when two lines or areas partly overlay each other. The types of geometries which can overlap are:
· Area-to-area
· Line-to-line
The overlay of a line must also be a line. When two lines meet at 0-D, the intersection is considered a cross.
Touch
Two geometries touch when one object’s boundary meets the other’s boundary or interior but the interiors do not meet. The types of geometries that can touch are:
· Area-to-area
· Area-to-line
· Area-to-point
· Line-to-line
· Line-to-point
Touch relationship with boundaries meeting:
Touch relationship with boundary meeting interior.
Within
A Within relationship occurs when a geometry’s boundary and interior are inside a containing geometry and the interiors of the geometries meet. Within is the reciprocal relationship to Contains. The types of geometries which can be within another are:
· Area-to-area
· Area-to-line
· Area-to-point
· Line-to-line
· Line-to-point
· Point-to-point
Within relationship, boundaries not touching:
Within relationship, boundaries touching:
A geometry that lies entirely on the boundary of another geometry is not within that geometry.
Within Distance
Within Distance is a spatial relationship. The relationship checks that at the closest point, two geometries are within a specified in dataset units.
Dataset units are decimal degrees for latitude/longitude.