# Spatial relationships in the GeoAnalytics Desktop toolbox

The Join Features  tool allows you to join features in one layer to features in another layer based on their relative locations. This is called a spatial join. Along with a spatial join, Join Features also allows you to apply a temporal join and an attribute join. In defining the spatial join, there are a number of spatial relationships you can use to select the point, polyline, or polygon features in one layer that exhibit the relationship of interest with the features in another layer.

For example, to find the number of homes that were affected by a recent flood, you could join the homes layer to the flood boundary using the Within spatial relationship operator.

## Join and target layers

A spatial join matches features from the join layer to the target layer based on the features' relative spatial locations.

The following legend applies to all the examples in this topic:

• Target features—Green
• Join features—Purple
• Target feature exhibits the selected spatial relationship with join feature—Red highlight

## Spatial relationships between features

In a spatial relationships between features, each type of geometry (point, polyline, and polygon) has an interior and a boundary. How the interiors and boundaries of two geometries compare determines the spatial relationship they exhibit. The following image outlines the geometries, boundaries, and interiors of points, polylines, and polygons:

The relationships supported by the GeoAnalytics Desktop tools are Clementini, meaning a polygon boundary is separate from its interior and exterior.

### Geometry types and supported relationships

The following table lists the supported spatial relationships for a spatial join between geometries of a given type (for example, joining points to other points):

Spatial join (target to join feature) betweenEqualsIntersectsContainsWithinCrossesTouchesOverlapsPlanar NearGeodesic Near

Point and point

Point and polyline

Point and polygon

Polyline and point

Polyline and polyline

Polyline and polygon

Polygon and point

Polygon and polyline

Polygon and polygon

#### Equals

A target feature is equal to a join feature if their interiors are identical and the geometry types are the same.

The target features in green are highlighted with red when they are equal to the purple features.

#### Intersects

A target feature intersects a join feature if it shares any portion of its geometry with the join feature. If a target feature contains, is within, crosses, touches, or overlaps a join feature, it intersects.

The target features in green are highlighted with red when they intersect the purple features.

#### Contains

A target feature contains a join feature if the join feature is a subset of the target feature, with intersecting interiors. If the join feature is on the boundary and intersects the interior, the target feature contains the joined feature. If the join feature is only on the boundary (and not the interior), the target feature does not contain the joined feature.

This is the inverse of the Within operator.

The target features in green are highlighted with red when they contain the purple features.

#### Within

A target feature is within a join feature if it is completely inside the join feature. A feature is within if the intersection of the interiors is nonempty and the target feature is a subset of the join features. If there is no intersecting interior, the join feature is not within the target feature.

This is the inverse of the Contains operator.

The target features in green are highlighted with red when they are within the purple features.

#### Crosses

Two polylines cross if their intersection contains only points, and at least one of the points of intersection is internal to both polylines. A polyline and polygon cross if a connected part of the polyline is partly inside and partly outside the polygon. A polyline and polygon cross if they share a polyline in common on the interior of the polygon, which is not equal to the entire polyline. The target and join features must be either polylines or polygons.

The target features in green are highlighted with red when they cross the purple features.

#### Touches

A target feature touches a join feature if they have an intersecting vertex, but the features do not overlap.

#### Overlaps

Two geometries overlap if they are the same geometry type, and their intersection also has the same geometry type but the intersection is different from both of the original geometries.

#### Planar Near and Geodesic Near

Conceptually, these operators buffer the target features using the specified distance and return all the target features that intersect the join features with the buffer applied.

The Geodesic Near operation is the same as Planar Near, except geodesic distance is used rather than planar distance. Choose this operator if your data covers a large geographic extent or the coordinate system of the inputs is geographic.

The target features in green, with a near distance buffer (light green), are highlighted with red when they are near the purple join features.