Skip to main content

relate

Computes the DE-9IM string for a pair of geometries a and b.

The result is a 9-character string described by the regular expression /^[F012]{9}$/.
Each character represents a dimension of intersection:

  • F - no intersection (-1 dimension)
  • 0 - point
  • 1 - line
  • 2 - area
warning

Do not use this function with invalid geometries. You will get unexpected results.

Parameters

NameTypeDescription
aGeometry | Prepared<Geometry>First geometry
bGeometrySecond geometry

Returns

string

DE-9IM matrix string for the spacial relationship between geometries a and b

Throws

  • GEOSError on unsupported geometry types (curved)

See also

  • relatePattern returns true if spatial relationship between two geometries matches the specified pattern
  • prepare improves performance of repeated calls against a single geometry

Examples