# Spatial Relations Defined

Spatial relationships are described by predicates - keywords that indicate the type of relationship each piece of geometry has with another. These relationships are defined by the OGC (Open Geospatial Consortium), and are interpreted in FME.

Spatial relationships are based on how three components of a feature intersect - or don't intersect - with another feature. Each feature has an INTERIOR, BOUNDARY, and EXTERIOR. These terms are defined below for various geometry types. How these components interact determines the type of spatial relationship features have, and which predicates they match.

Spatial relations are undefined for geometries that are not OGC valid or aggregate geometries. For definitive documentation on spatial relations, please consult the OGC documentation. For more information on how FME handles aggregate and multi geometries, see below.

## Spatial Predicates

Predicates - such as Intersects, Contains, Overlaps, and more - are commonly used in spatial joins. The SpatialFilter and SpatialRelator allow explicit spatial query construction using predicates.

Each of the supported predicates is described here, along with some associated examples and pattern matrices. Note that the examples are not exhaustive: there may be entirely different situations where a given predicate is true.

### Spatial Predicates with Examples

In these examples, the base is labeled "A" and the candidate is labeled "B".

Geometry examples are shown comparing points, lines, and areas. Bases are in blue, candidates in yellow. Examples showing multiple bases or candidates do not represent multi or aggregate geometry, rather, they indicate alternate scenarios that match the predicate.

Predicate

Description

Geometry Examples

Pattern Matrix*

Intersects The two features are not disjoint, as defined next.

Disjoint

The boundaries and interiors do not intersect.
Equals

The features have the same boundary and the same interior.

Touches

The boundaries may intersect or one boundary may intersect the other interior.

The interiors do not touch.

Undefined for point/point.

Crosses

The interiors intersect and the base’s interior intersects the candidate’s exterior.

Or in the case of line/line, the intersection of the interiors forms a point.

Undefined for point/point or area/area.

Undefined for aggregate/multi geometries.

For two lines:

Overlaps

The interiors intersect, but neither feature is contained by the other, nor are the features equal.

Undefined for point/line, point/area, or line/area.

Undefined for aggregate/multi geometries.

For two lines:

Contains

The interiors intersect and no part of the candidate's interior or boundary intersects the base's exterior. It is possible for the boundaries to intersect.

Inverse of WITHIN.

Within

The interiors intersect and no part of the base's interior or boundary intersects the candidate's exterior. It is possible for the boundaries to intersect.

Inverse of CONTAINS.

## Aggregates and Multi Geometry

Spatial relationships for aggregate and multi geometries are not clearly defined, and should be used with care. Where reasonable, FME uses an intuitive definition to analyze these relationships, however, these are not well-known definitions according to any public standard.