# 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 inputs that are not OGC valid geometries or aggregates of OGC valid geometries. For definitive documentation on spatial relations, please consult the OGC documentation. For more information on how FME handles aggregate and multi geometries, which differs from OGC’s documentation, see below.

## Spatial Predicates

Predicates - such as OGC-Intersects, OGC-Contains, OGC-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*

OGC-Intersects The two features are not OGC-Disjoint, as defined next.

OGC-Disjoint

The boundary and interior of each feature do not intersect the boundary or interior of the other.
OGC-Equals

The features have the same boundary and the same interior.

OGC-Touches

The interiors do not intersect, but either the boundaries intersect or one boundary intersects the other interior.

OGC-Crosses

The base has a lower dimensionality than the candidate and its interior intersects the candidates interior and exterior.

Alternatively, both inputs are lines and their interiors only intersect at points.

• Undefined for area/point, area/line, point/point or area/area.
• Undefined for aggregate/multi geometries.

For two lines:

OGC-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:

OGC-Contains

The interiors intersect and no part of the candidate's interior or boundary intersects the base's exterior. The candidate’s interior or boundary may intersect the base’s boundary.

Inverse of WITHIN.

OGC-Within

The interiors intersect and no part of the base's interior or boundary intersects the candidate's exterior. The base’s interior or boundary may intersect the candidate’s boundary.

Inverse of CONTAINS.

## Aggregates and Multi Geometry

Spatial relationships for aggregate and multi geometries are not clearly defined, and should be used with care.

OGC has definitions for valid MultiPoints, MultiCurves, MultiSurfaces, and how they interact with spatial relationships, but FME does not currently adopt these definitions. Instead, simple extensions are provided for aggregates of OGC valid geometries, as described below.

## Transformer Terminology

Spatial predicate descriptions vary according to context. The following terms are equivalent to Base and Candidate as used here.

Transformer

Base

Candidate

SpatialFilter Filter Candidate
SpatialRelator Requestor Supplier