pyinterp.geometry.cartesian.algorithms.relate

Contents

pyinterp.geometry.cartesian.algorithms.relate#

pyinterp.geometry.cartesian.algorithms.relate(geometry1: pyinterp.core.geometry.cartesian.Point, geometry2: pyinterp.core.geometry.cartesian.Point, mask: str) bool#
pyinterp.geometry.cartesian.algorithms.relate(geometry1: pyinterp.core.geometry.cartesian.LineString, geometry2: pyinterp.core.geometry.cartesian.LineString, mask: str) bool
pyinterp.geometry.cartesian.algorithms.relate(geometry1: pyinterp.core.geometry.cartesian.Ring, geometry2: pyinterp.core.geometry.cartesian.Ring, mask: str) bool
pyinterp.geometry.cartesian.algorithms.relate(geometry1: pyinterp.core.geometry.cartesian.Ring, geometry2: pyinterp.core.geometry.cartesian.Polygon, mask: str) bool
pyinterp.geometry.cartesian.algorithms.relate(geometry1: pyinterp.core.geometry.cartesian.Polygon, geometry2: pyinterp.core.geometry.cartesian.Ring, mask: str) bool
pyinterp.geometry.cartesian.algorithms.relate(geometry1: pyinterp.core.geometry.cartesian.Polygon, geometry2: pyinterp.core.geometry.cartesian.Polygon, mask: str) bool

Checks if two geometries satisfy a DE-9IM (Dimensionally Extended nine-Intersection Model) relationship mask.

The DE-9IM mask is a 9-character pattern that specifies the required relationship between the interior/boundary/exterior of two geometries. This function returns true if the actual relationship matches the mask pattern.

Parameters:
  • geometry1 – First geometry.

  • geometry2 – Second geometry.

  • mask – DE-9IM mask pattern as a 9-character string (e.g., “T*F**F***” for within). Each character can be: - ‘T’ (true): non-empty intersection required - ‘F’ (false): empty intersection required - ‘*’: any dimension (don’t care) - ‘0’, ‘1’, ‘2’: specific dimension required

Returns:

Boolean indicating if the geometries satisfy the mask relationship.

Examples

>>> point = Point(4.0, 1.0)
>>> polygon = Polygon(...)

Check if point is within polygon

>>> is_within = relate(point, polygon, "T*F**F***")
>>> # Returns True if point is inside polygon