Skip to content

GeometryArray

The immutable columnar geometry container, with NumPy-native results and the same operation names as Geometry.

Related: Arrays & performance

GeometryArray

Accepted call forms
GeometryArray(
    values: Iterable[None], *, space: Space | None = None
) -> GeometryArray[Geometry | None]
GeometryArray(
    values: Iterable[GeometryT_co], *, space: Space | None = None
) -> GeometryArray[GeometryT_co]
GeometryArray(
    values: Iterable[
        GeometryT_co | Buffer | Mapping[str, Any] | SupportsGeoInterface
    ],
    *,
    space: Space | None = None,
) -> GeometryArray[Geometry | GeometryT_co]

An immutable array of geometries sharing one CRS/epoch frame.

The vectorized counterpart of Geometry: methods mirror the scalar names element-wise (arr.area, (arr).buffer(10.0), contains(arr, geom)) and run as batched Rust kernels with no per-element Python. Homogeneous point, line, and polygon arrays pack into shared coordinate columns (with CSR offsets where needed) for zero-copy Arrow and columnar kernels. Build with GeometryArray(...) / points(...) or the WKT/WKB/GeoJSON/Arrow importers; index and slice it like a sequence. An immutable, vectorized geometry column with one shared CRS/epoch frame.

Homogeneous arrays use packed coordinate storage and batched Rust kernels; indexing and slicing preserve zero-copy views where possible.

Construct an immutable array from geometry-like rows.

Iterable values are consumed once in input order. None creates a missing row. A single Geometry is not a row iterable; wrap it in a one-item sequence. Rows may be native geometries, WKB byte buffers, GeoJSON mappings, or objects exposing __geo_interface__. space= assigns raw imports and validates native values without transforming them.

Parameters:

Name Type Description Default
values Iterable[None] | Iterable[GeometryT_co] | Iterable[GeometryT_co | Buffer | Mapping[str, Any] | SupportsGeoInterface]

One native geometry, WKB buffer, GeoJSON mapping, or object exposing __geo_interface__ per input position; None marks a missing row.

required
space Space | None

Complete shared interpretation. Omission infers from native values or a declared column; an anonymous empty input defaults to unreferenced planar. Native values must have compatible frames and domains, and their curves must already use the selected model.

None

Returns:

Type Description
GeometryArray

An immutable, row-aligned array with missing positions preserved.

Raises:

Type Description
TypeError

If values is a single geometry or contains an unsupported value.

CRSMismatchError

If a native or declared source frame conflicts with the shared Space.

GeometryError

If models conflict or mixed geographic points lack a common Space.

ParseError

If a WKB or GeoJSON row is malformed.

area property

area: NDArray[float64]

Per-row area, measured for the array's CRS.

A geographic CRS uses its ellipsoid by default, while the complete Space still selects represented paths and polygon interiors: Planar keeps coordinate-plane topology, Chart uses straight periodic longitude/ latitude edges, and Spherical uses great-circle arcs. Projected CRSs use squared native linear units; CRS-free rows use squared coordinate units. Use to_space to transform coordinates or with_space to deliberately reinterpret them.

Each GeometryCollection row counts overlapping members once, as the area of their union. Parts of a valid MultiPolygon cannot overlap.

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); 0 for points and curves; nan for missing rows.

Raises:

Type Description
CRSError

If the CRS lacks linear axis units for a metric result.

See Also

length : Length/perimeter under the same CRS-aware metric.

bounds property

bounds: NDArray[float64]

Per-geometry bounds (minx, miny, maxx, maxy) (see Geometry.bounds), as a read-only (rows, 4) float64 ndarray. Empty and missing rows are all-nan; use .is_missing to distinguish missing rows. Geographic longitude intervals may cross the seam, with minx > maxx.

Returns:

Type Description
ndarray

One minx, miny, maxx, maxy row per input geometry.

common_coordinate_axes property

common_coordinate_axes: Literal['XY', 'XYZ', 'XYM', 'XYZM'] | None

Ordinate layout shared by every present row, or None when rows differ.

Returns:

Type Description
str or None

coordinate_axes property

coordinate_axes: list[Literal['XY', 'XYZ', 'XYM', 'XYZM'] | None]

Per-geometry ordinate layout (see Geometry.coordinate_axes), with None at missing rows.

Returns:

Type Description
list of str or None

One 'XY'/'XYZ'/'XYM'/'XYZM' token per row.

coords property

coords: Coordinates

Returns:

Type Description
Coordinates

Flattened coordinates from present rows; missing rows contribute no coordinates. This is a vertex stream, not a row-aligned view; use .row_index to recover source-row alignment.

crosses_antimeridian property

crosses_antimeridian: NDArray[bool_]

Element-wise antimeridian-crossing test.

Returns:

Type Description
ndarray

One result per input geometry.

Raises:

Type Description
CRSError

If the CRS is projected (a geographic CRS or CRS-free lon/lat is required).

crs property

crs: CRS | None

CRS shared by every geometry in the array, or None.

Returns:

Type Description
CRS or None

epoch property

epoch: float | None

Coordinate epoch shared by the array, if set.

Returns:

Type Description
float or None

geometry_type property

geometry_type: list[
    Literal[
        'Point',
        'MultiPoint',
        'LineString',
        'MultiLineString',
        'Polygon',
        'MultiPolygon',
        'GeometryCollection',
        'CircularString',
        'CompoundCurve',
        'CurvePolygon',
        'MultiCurve',
        'MultiSurface',
        'PolyhedralSurface',
        'TIN',
        'Triangle',
    ]
    | None
]

Per-geometry OGC type name (see Geometry.geometry_type), with None at missing rows.

Returns:

Type Description
list of str or None

One name per input geometry, e.g. 'Point' or 'MultiPolygon'.

has_m property

has_m: NDArray[bool_]

Whether each geometry carries an M ordinate. Missing rows are false.

Returns:

Type Description
ndarray

has_z property

has_z: NDArray[bool_]

Whether each geometry carries a Z ordinate. Missing rows are false.

Returns:

Type Description
ndarray

is_ccw property

is_ccw: NDArray[bool_]

Per-geometry counter-clockwise test (see Geometry.is_ccw).

Returns:

Type Description
ndarray

One result per input geometry.

is_closed property

is_closed: NDArray[bool_]

Per-geometry closed test (see Geometry.is_closed).

Returns:

Type Description
ndarray

One result per input geometry.

is_convex property

is_convex: NDArray[bool_]

Per-geometry polygon convexity test (see Geometry.is_convex).

Returns:

Type Description
ndarray

is_empty property

is_empty: NDArray[bool_]

Whether each geometry is empty (no points, rings, or parts).

Returns:

Type Description
ndarray

One result per input geometry.

is_missing property

is_missing: NDArray[bool_]

Which rows are missing, as a boolean numpy.ndarray.

True marks a missing row (None on access); a dense array returns all-False.

Returns:

Type Description
ndarray

One bool per row.

Examples:

>>> import gometry as gm
>>> gm.GeometryArray([gm.Point(0, 0), None]).is_missing.tolist()
[False, True]

is_ring property

is_ring: NDArray[bool_]

Per-geometry ring test (see Geometry.is_ring).

Returns:

Type Description
ndarray

One result per input geometry.

is_simple property

is_simple: NDArray[bool_]

Per-geometry simplicity test (see Geometry.is_simple).

Returns:

Type Description
ndarray

One result per input geometry.

is_valid property

is_valid: NDArray[bool_]

Per-element validity mask (see Geometry.is_valid).

Returns:

Type Description
ndarray

True where the geometry is valid, one entry per row.

length property

length: NDArray[float64]

Per-row length (curves) or perimeter (areal), measured for the array's CRS.

A geographic CRS uses its ellipsoid by default, while the complete Space still selects represented paths: Planar keeps coordinate-plane edges, Chart uses straight periodic longitude/latitude edges, and Spherical uses great-circle arcs. Projected CRSs use native linear units; CRS-free rows use raw coordinate units. Use to_space to transform coordinates or with_space to deliberately reinterpret them.

Each GeometryCollection row sums every member's length or perimeter, including overlapping members.

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); 0 for points; nan for missing rows.

Raises:

Type Description
CRSError

If the CRS lacks linear axis units for a metric result.

See Also

area : Area under the same CRS-aware metric.

length_3d property

length_3d: NDArray[float64]

Per-row 3D length of curves with Z, measured for the array's CRS.

Geographic CRSs do not support 3D Euclidean length.

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); nan where Z is missing on a vertex or the row is missing.

Raises:

Type Description
CRSError

If the CRS lacks linear axis units for a metric result.

max_m property

max_m: NDArray[float64]

Per-row largest M ordinate (nan where a geometry carries no M).

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); nan where M is absent or the row is missing.

max_z property

max_z: NDArray[float64]

Per-row largest Z ordinate (nan where a geometry carries no Z).

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); nan where Z is absent or the row is missing.

min_m property

min_m: NDArray[float64]

Per-row smallest M ordinate (nan where a geometry carries no M).

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); nan where M is absent or the row is missing.

min_z property

min_z: NDArray[float64]

Per-row smallest Z ordinate (nan where a geometry carries no Z).

Returns:

Type Description
ndarray

Read-only float64 numpy.ndarray of shape (n,); nan where Z is absent or the row is missing.

nbytes property

nbytes: int

Logical coordinate payload in bytes (numpy's nbytes convention): the stored f64 ordinate columns for this array's selected rows. Slices and fancy-indexed arrays report only their logical rows. Object headers, CSR offset columns, row maps, prepared-geometry / frame sidecars and CRS metadata are excluded (nbytes is payload-only, matching NumPy).

Returns:

Type Description
int

num_coordinates property

num_coordinates: ndarray[tuple[int], dtype[int64]] | NDArray[object_]

Per-geometry coordinate count. Missing rows are 0.

Returns:

Type Description
ndarray

One coordinate count per input geometry. The array uses int64 when every count fits; otherwise it uses object with exact Python integers.

num_geometries property

num_geometries: ndarray[tuple[int], dtype[int64]]

Per-geometry top-level part count (see Geometry.num_geometries): 1 for a single-part geometry, including a typed empty; the member count for a multi/collection, and 0 for an empty multipart or collection. Explicit empty members still count in their multipart's member count. Missing rows have count 0; use .is_missing to distinguish them from present empty geometries.

Returns:

Type Description
ndarray

One count per input geometry.

parts property readonly

parts: ListArray[GeometryArray[Geometry] | None]

Top-level parts grouped by source row.

Single-part geometries form one-element groups, including typed empties. Multipart and collection geometries expose their immediate members, so an empty member list forms an empty group. Missing rows remain missing groups.

Returns:

Type Description
ListArray

One group per input row; missing rows yield None.

space property

space: Space

Complete interpretation shared by every row, including missing rows.

Returns:

Type Description
Space

topological_dimension property

topological_dimension: ndarray[tuple[int], dtype[int64]]

Per-geometry topological dimension — 0 point, 1 curve, 2 areal (see Geometry.topological_dimension). Missing rows use -1; use .is_missing to distinguish them from present point-like geometries.

Returns:

Type Description
ndarray

One dimension per input geometry.

total_bounds property

total_bounds: tuple[float, float, float, float] | None

Combined bounds (minx, miny, maxx, maxy) over all geometries, or None if every geometry is empty. Geographic longitude bounds use the CRS's periodic interval, so minx > maxx denotes a seam crossing.

Returns:

Type Description
tuple or None

__bool__

__bool__() -> bool

False only when the array has zero rows.

Returns:

Type Description
bool

__contains__

__contains__(value: object, /) -> bool

Whether a geometry (or missing row via None) is present.

Equality is structural (Geometry.__eq__): CRS, epoch, and exact geometry. None in arr is true when any row is missing.

Returns:

Type Description
bool

__getitem__

Accepted call forms
__getitem__(
    index: ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]],
    /,
) -> GeometryT_co
__getitem__(
    index: ndarray[
        tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]
    ],
    /,
) -> GeometryArray[GeometryT_co]
__getitem__(
    index: ndarray[tuple[int], dtype[bool_]], /
) -> GeometryArray[GeometryT_co]
__getitem__(
    index: ndarray[
        tuple[Any, ...], dtype[signedinteger[Any] | unsignedinteger[Any]]
    ],
    /,
) -> GeometryT_co | GeometryArray[GeometryT_co]
__getitem__(index: SupportsIndex, /) -> GeometryT_co
__getitem__(index: slice, /) -> GeometryArray[GeometryT_co]
__getitem__(index: Sequence[bool], /) -> GeometryArray[GeometryT_co]
__getitem__(
    index: Sequence[SupportsIndex]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Buffer,
    /,
) -> GeometryArray[GeometryT_co]
__getitem__(
    index: SupportsIndex
    | slice
    | ndarray[tuple[int], dtype[bool_]]
    | Sequence[bool]
    | (
        Sequence[SupportsIndex]
        | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
        | Buffer
    )
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[
        tuple[Any, ...], dtype[signedinteger[Any] | unsignedinteger[Any]]
    ],
    /,
) -> GeometryT_co | GeometryArray[GeometryT_co]

Select rows by integer, slice, or fancy index.

An int returns one typed geometry (or raises IndexError). A slice or integer sequence / boolean mask returns a gathered GeometryArray (missing rows stay missing).

Returns:

Type Description
Geometry or GeometryArray

Scalar geometry for an int index; array for slice/fancy selection.

__iter__

__iter__() -> Iterator[GeometryT_co]

Iterate geometries in row order (including missing rows as None).

Returns:

Type Description
iterator of Geometry or None

__len__

__len__() -> int

Number of rows (including missing rows).

Returns:

Type Description
int

__reversed__

__reversed__() -> GeometryArrayIterator[GeometryT_co]

Iterate geometries in reverse row order.

Returns:

Type Description
iterator of Geometry or None

affine_transform

affine_transform(
    matrix: tuple[float, float, float, float, float, float] | Iterable[float],
) -> Self

Apply a 2D affine transform (a, b, d, e, xoff, yoff) to a geometry.

Parameters:

Name Type Description Default
matrix sequence of float

The six affine coefficients (a, b, d, e, xoff, yoff).

required

Returns:

Type Description
GeometryArray

One transformed geometry per row (kinds preserved).

Raises:

Type Description
GeometryError

If matrix is not 6 finite numbers.

Examples:

>>> import gometry as gm
>>> gm.LineString([(0, 0), (1, 1)]).affine_transform([2, 0, 0, 2, 1, 1]).to_wkt()
'LINESTRING (1 1, 3 3)'

boundary

Accepted call forms

Return the topological boundary of the geometry's occupied support.

Returns:

Type Description
GeometryArray

One boundary per row, retaining missing rows.

Notes

Each row is processed independently. Non-missing outputs retain their row's CRS and coordinate epoch. Output coordinate axes reflect ordinates available at every emitted vertex.

Raises:

Type Description
CRSError

If the declared CRS cannot be resolved to a topology frame.

InvalidGeometryError

If a geographic coordinate read by boundary is outside its CRS domain.

ResourceLimitError

If exact work exceeds the generated-item or embedding-search budget.

OverflowError

If emitted cells cannot preserve the exact topology in binary64.

Examples:

>>> import gometry as gm
>>> gm.box(0, 0, 2, 2).boundary().to_wkt()
'LINESTRING (0 0, 2 0, 2 2, 0 2, 0 0)'

buffer

Accepted call forms
buffer(
    distance: FloatInput,
    *,
    cap_style: Literal['round', 'flat', 'square'] = 'round',
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    side: Literal['both', 'left', 'right'] = 'both',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon]
buffer(
    distance: FloatInput,
    *,
    cap_style: Literal['round', 'flat', 'square'] = 'round',
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    side: Literal['both', 'left', 'right'] = 'both',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon | None]
buffer(
    distance: float,
    *,
    cap_style: Literal['round', 'flat', 'square'] = 'round',
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    side: Literal['both', 'left', 'right'] = 'both',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon | MultiPolygon]
buffer(
    distance: float,
    *,
    cap_style: Literal['round', 'flat', 'square'] = 'round',
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    side: Literal['both', 'left', 'right'] = 'both',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon | MultiPolygon | None]
buffer(
    distance: FloatInput,
    *,
    cap_style: Literal['round', 'flat', 'square'] = 'round',
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    side: Literal['both', 'left', 'right'] = 'both',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon | MultiPolygon]
buffer(
    distance: FloatInput,
    *,
    cap_style: Literal['round', 'flat', 'square'] = 'round',
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    side: Literal['both', 'left', 'right'] = 'both',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon | MultiPolygon | None]

Construct an XY buffer region while preserving the complete input Space.

The ordinary positive round buffer is the closed metric neighborhood, including selected source interiors. Negative distances erode areal support; a point or line has an empty buffer at nonpositive distance. Empty remains empty, and a full geographic surface remains full for every finite distance.

Geographic construction follows the retained Chart or Spherical source curves on the selected measuring surface. Physical Planar geographic results stay on their original longitude sheet; a pole-enclosing or full-period result requires to_space() with a geographic Space. Cartesian construction requires Planar Space. Every buffer synthesizes XY and preserves CRS and coordinate epoch.

Parameters:

Name Type Description Default
distance float or sequence of float

Buffer radius; negative shrinks areal geometries. CRS-aware: geodesic meters on a geographic CRS, native linear units on a projected CRS, raw coordinate units when CRS-free — a scalar applies to every geometry, or pass one value per geometry. Every distance must be finite.

required
cap_style ('round', 'flat', 'square')

End-cap shape at the original first and last vertices of open lines. Closed lines have no end caps. Point inputs always buffer to round discs, and MultiPoint buffers are unions of round discs; cap_style does not affect either. Sided buffers always use flat ends, so this parameter applies to side='both' only.

'round'
join_style ('round', 'miter', 'bevel')

Interior corner style for both two-sided and sided line buffers, including 180-degree reversals.

'round'
tolerance float or None

Scalar nonnegative finite positional target in the active construction units. Automatic quality uses the sagitta of a 32-chord circle at abs(distance). Zero requests highest practical fidelity. This changes boundary approximation, not the requested radius or source topology.

None
miter_limit float

With join_style='miter': how far a mitered corner may reach, in multiples of distance; sharper corners are clipped flat at that reach. Applies to both two-sided and sided buffers; must be positive and finite.

5.0
side ('both', 'left', 'right')

Which side(s) of lineal input to buffer. 'left'/'right' build the one-sided strip between the line and its offset curve, with flat ends. These sides honor join_style, tolerance, and miter_limit. Their input must be lineal and the distance must be non-negative.

'both'
metric 'cartesian'

Measuring surface, independent of the retained source curves. The default uses the CRS-natural metric. 'cartesian' uses the Planar coordinate plane without geographic clipping or wrapping; Sphere requires a geographic CRS. Geographic carried styles require their supported local construction domain.

'cartesian'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
GeometryArray

One buffer region per row, preserving missing rows. Each row has its own generated-work allowance.

Raises:

Type Description
InvalidGeometryError

If coordinates are non-finite or buffer arithmetic produces a non-finite derived coordinate.

GeometryError

If distance, tolerance, styles, metric or units are invalid, or the result cannot be represented in its input Space. Geographic Planar branch errors name to_space().

ResourceLimitError

If required output or generated construction work exceeds its budget.

GeometryTypeError

If side is 'left'/'right' and the geometry is not lineal.

See Also

offset_curve : Visible or raw signed source-corresponding line offsets.

Examples:

>>> import gometry as gm
>>> disc = gm.Point(0, 0).buffer(10)
>>> assert gm.covers(disc, gm.Point(0, 0))

build_area

Accepted call forms
build_area() -> GeometryArray[Polygon | MultiPolygon]
build_area() -> GeometryArray[Polygon | MultiPolygon | None]
build_area() -> GeometryArray[
    Polygon | MultiPolygon | GeometryCollection | None
]

Assemble linework into one areal geometry. Input ordinates are carried where vertices can be sourced; otherwise the mathematically planar result is XY. When returned polygons retain different coordinate axes, they remain separate members of a GeometryCollection rather than being promoted or flattened. The GeometryArray method processes rows independently; to assemble linework from several geometries as one area, combine them into one GeometryCollection first.

Returns:

Type Description
GeometryArray

One areal geometry per input row; missing rows remain missing.

Raises:

Type Description
InvalidGeometryError

If the area cannot be assembled from the input linework.

Examples:

>>> import gometry as gm
>>> edges = [[(0,0),(2,0)],[(2,0),(0,2)],[(0,2),(0,0)]]
>>> gm.MultiLineString(edges).build_area().to_wkt()
'POLYGON ((0 0, 2 0, 0 2, 0 0))'

centroid

Accepted call forms
centroid(
    *, metric: Literal['cartesian'] | Sphere | None = None
) -> GeometryArray[Point]
centroid(
    *, metric: Literal['cartesian'] | Sphere | None = None
) -> GeometryArray[Point | None]

Center of mass on the selected measuring surface. Geographic input uses the CRS ellipsoid by default; metric=Sphere() selects a sphere, with an optional radius in meters. Regions contribute area, curves contribute length, and points contribute equal mass; only the highest-dimensional mass contributes. The result is projected radially onto that surface and returned as an XY point in the source Space. Z and M do not contribute to mass. Empty input returns POINT EMPTY; a nonempty input with no net direction returns POINT (0 0). metric='cartesian' selects coordinate-plane measurement and requires a Planar Space. Geographic input crossing the antimeridian is handled in its declared Space.

Parameters:

Name Type Description Default
metric 'cartesian'

None uses the CRS metric; 'cartesian' requires Planar Space. Sphere() or Sphere(radius) selects a sphere for a geographic CRS. Sphere() uses the CRS authalic radius; an explicit positive finite radius is in meters. The selection changes measurement, not the source Space.

'cartesian'

Returns:

Type Description
GeometryArray[Point]

One centroid per row; missing rows remain missing. Empty geometries produce POINT EMPTY.

See Also

point_on_surface : A representative point guaranteed on the geometry. polylabel : Pole of inaccessibility (best label anchor).

Raises:

Type Description
CRSError

If the selected metric is incompatible with the source CRS.

InvalidGeometryError

If geographic measurement encounters a latitude outside the source CRS's pole limits.

Examples:

>>> import gometry as gm
>>> (gm.box(0, 0, 2, 4).centroid()).to_wkt()
'POINT (1 2)'

concat

Accepted call forms
concat(
    other: GeometryArray[GeometryOtherT],
    /,
    *others: GeometryArray[GeometryOtherT],
) -> GeometryArray[GeometryT_co | GeometryOtherT]
concat(
    other: GeometryArray[GeometryOtherT | None],
    /,
    *others: GeometryArray[GeometryOtherT | None],
) -> GeometryArray[GeometryT_co | GeometryOtherT | None]
concat() -> GeometryArray[GeometryT_co]

Concatenate zero or more arrays sharing this array's CRS and epoch. With no arrays, return this array.

Parameters:

Name Type Description Default
other GeometryArray

First array to append; it must share this array's CRS and epoch.

required
others GeometryArray

Additional arrays to append in order; each must share this array's CRS and epoch.

required

Returns:

Type Description
GeometryArray

Examples:

>>> import gometry as gm
>>> a = gm.GeometryArray([gm.box(0, 0, 1, 1)])
>>> a.concat(gm.GeometryArray([gm.Point(2, 2)])).to_wkt()
['POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))', 'POINT (2 2)']

concave_hull

Accepted call forms
concave_hull(
    *,
    concavity: FloatInput = 2.0,
    length_threshold: FloatInput = 0.0,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
    allow_holes: bool = False,
) -> GeometryArray[Point | LineString | Polygon]
concave_hull(
    *,
    concavity: FloatInput = 2.0,
    length_threshold: FloatInput = 0.0,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
    allow_holes: bool = False,
) -> GeometryArray[Point | LineString | Polygon | None]

Return one source-conforming concave hull of the complete represented geometry, including retained linework and selected filled regions. Planar and Spherical Spaces are supported; Chart Space must be converted with to_space. The selected metric scores complete retained edges without changing their source model. Original source locations supply scores and ordinates; scaffold-only corners are never treated as input sites. Z and M come from retained source correspondences; an ordinate axis is omitted when any published boundary site lacks it.

Parameters:

Name Type Description Default
concavity float or sequence of float

Controls the distance guards on candidate boundary edges. For positive values, a source location must be no farther than L / concavity from the complete edge of length L and strictly closer than that limit to at least one endpoint. 0 disables both guards. A scalar applies to every geometry, or pass one value per row. Values must be finite and non-negative.

2.0
length_threshold float or sequence of float

Keep edges at or below this selected-metric length. A scalar applies to every row, or pass one value per geometry. Values must be finite and non-negative, in the selected metric's units. For fixed input and concavity, a larger threshold cannot shrink the published hull.

0.0
metric 'cartesian'

Select Cartesian measurement for Planar Space or a spherical measuring surface for geographic Space. Omission uses the CRS-based default.

"cartesian"
unit 'meters'

Interpret length thresholds in meters. Without this option, Planar measurements use the metric's native linear or coordinate units; geographic physical measurements use meters.

"meters"
allow_holes bool

Whether the hull may retain holes. True permits but does not require them; the scalar choice applies to every present row.

False

Returns:

Type Description
GeometryArray

One hull per row, retaining missing rows. Each nonempty result encloses the complete source support and is a Point, LineString, or Polygon.

Raises:

Type Description
GeometryError

If a parameter is non-finite or negative, Chart Space is used, or the source-conforming hull cannot be represented as one connected Polygon.

CRSError

If the CRS cannot provide the selected metric or a physical geographic coordinate is outside its longitude/latitude domain.

See Also

convex_hull : Smallest convex set containing the geometry (planar).

Examples:

>>> import gometry as gm
>>> mp = gm.MultiPoint([(0, 0), (2, 0), (2, 2), (0, 2), (1, 0.2)])
>>> hull = mp.concave_hull(concavity=1.0)
>>> hull.geometry_type
'Polygon'

convex_hull

Accepted call forms
convex_hull() -> GeometryArray[Point | LineString | Polygon]
convex_hull() -> GeometryArray[Point | LineString | Polygon | None]

Compute the convex hull of the geometry in a Planar or Spherical Space. Convert geographic input to a Planar Space with to_space when a cut chart is needed. Source vertices retained by the hull keep their ordinates. Geographic hull construction can add chart-support vertices on producer root edges; see the geometry guide's Z/M under operations section for how their ordinates are carried. When several input vertices share an XY position, the first in storage order is the copied survivor.

Returns:

Type Description
GeometryArray

One convex hull per row.

Raises:

Type Description
GeometryError

If selected hull vertices have different coordinate axis layouts.

See Also

concave_hull : Concave hull that can follow non-convex outlines.

Examples:

>>> import gometry as gm
>>> pts = gm.MultiPoint([(0, 0), (2, 0), (1, 1), (0, 2), (2, 2)])
>>> pts.convex_hull().to_wkt()
'POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))'

count

count(value: object) -> int

Number of structurally equal elements (list.count semantics, using Geometry.__eq__).

Parameters:

Name Type Description Default
value Geometry

The element to count.

required

Returns:

Type Description
int

How many elements equal value.

destination

Accepted call forms
destination(
    bearing: float | FloatInput,
    distance: float | FloatInput,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: float | FloatInput,
    distance: float | FloatInput,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: float | FloatInput,
    distance: float | FloatInput,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point | None]
destination(
    bearing: float | FloatInput,
    distance: float | FloatInput,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> GeometryArray[Point | None]

Walk each point along a geodesic or rhumb path. An empty point stays POINT EMPTY.

Parameters:

Name Type Description Default
bearing float or sequence of float

Initial azimuth in degrees clockwise from north.

required
distance float or sequence of float

Finite, non-negative distance to travel in CRS-natural units, unless unit is set.

required
path ('geodesic', 'rhumb')

Route model. Geodesic forms omit path; rhumb forms require path='rhumb' and a geographic CRS.

'geodesic'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement. Rhumb paths accept the default or an explicit meter unit.

'meters'
metric None, "cartesian", or Sphere

Measuring surface. Cartesian requires Planar Space; Sphere requires a geographic CRS. The default follows the CRS.

None

Returns:

Type Description
GeometryArray[Point]

One destination point per array row.

Raises:

Type Description
GeometryError

If bearing or distance is invalid.

CRSError

If the selected route requires an unavailable CRS metric.

GeometryTypeError

If an input row is not a point.

InvalidGeometryError

If a coordinate is outside the longitude/latitude domain.

Examples:

>>> import gometry as gm
>>> points = gm.GeometryArray([
...     gm.Point(0, 0, space=gm.Space(crs=4326)), gm.Point(1, 1, space=gm.Space(crs=4326))
... ])
>>> points.destination(90, 1000).quantize(5).to_wkt()[0]
'POINT (0.00898 0)'

dissolve

dissolve(
    by: Iterable[GroupKeyT],
    *,
    grid_size: FloatScalar
    | ScalarFloatArray
    | tuple[float, float]
    | Iterable[float] = 0.0,
    origin: GridOrigin = (0.0, 0.0),
) -> tuple[GeometryArray[Geometry], list[GroupKeyT]]

Dissolve geometries into per-group unions.

Planar uses straight coordinate segments. Chart and Spherical use their native geographic topology: periodic longitude/latitude segments and minor great-circle arcs, respectively.

With a positive grid size, each group reconstructs its present members jointly on one lattice before union, independently of other groups. Only XY is quantized; Z and M, when present, follow source-ordinate rules. Output retains its Space, including the coordinate epoch, but no grid policy. Later grid-free operations may produce off-grid coordinates.

Parameters:

Name Type Description Default
by iterable

One grouping key per row (same length as the array).

required
grid_size float or pair of float

Zero disables the grid. A positive scalar sets both XY spacings; a pair sets independent X and Y spacings, both strictly positive. Spacings must be finite and are in Space coordinate units, not physical distances.

0.0
origin pair of float

Finite X and Y offsets of the lattice in the same coordinate units. The origin does not affect grid-free results.

(0.0, 0.0)

Returns:

Type Description
tuple of (GeometryArray, list)

One union per group and the parallel first-occurring key objects, in order of first present row. Missing rows do not establish a group; present empty geometries do. An all-missing array yields zero groups and retains its Space.

Raises:

Type Description
GeometryError

If the requested lattice cannot represent a required coordinate or edge (code='precision_incompatible'). The group attribute is the zero-based position of the failing group in first-present key order. Also raised if the number of keys differs from the number of rows.

ResourceLimitError

If geographic grid reconstruction exceeds its work limit.

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.box(0, 0, 1, 1), gm.box(1, 0, 2, 1)])
>>> geoms, keys = arr.dissolve(by=[0, 0])
>>> keys
[0]
>>> gm.equals(geoms[0], gm.box(0, 0, 2, 1))
True

drop_missing

drop_missing() -> GeometryArray[GeometryT]

Return a new array without the missing rows.

Returns:

Type Description
GeometryArray

The present rows, in order; the input unchanged (and returned as-is when dense).

Examples:

>>> import gometry as gm
>>> len(gm.GeometryArray([gm.Point(0, 0), None]).drop_missing())
1

envelope

Accepted call forms
envelope(
    *,
    tolerance: FloatScalar
    | ScalarFloatArray
    | (
        FloatColumn
        | ndarray[
            tuple[int],
            dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
        ]
    )
    | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | Polygon]
envelope(
    *,
    tolerance: FloatScalar
    | ScalarFloatArray
    | (
        FloatColumn
        | ndarray[
            tuple[int],
            dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
        ]
    )
    | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | Polygon | None]
envelope(
    *,
    tolerance: FloatScalar
    | ScalarFloatArray
    | (
        FloatColumn
        | ndarray[
            tuple[int],
            dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
        ]
    )
    | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | LineString | Polygon | MultiPolygon]
envelope(
    *,
    tolerance: FloatScalar
    | ScalarFloatArray
    | (
        FloatColumn
        | ndarray[
            tuple[int],
            dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
        ]
    )
    | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | LineString | Polygon | MultiPolygon | None]

Return an XY enclosure in the input's complete Space. Planar and Chart values keep their coordinate-aligned envelope. Spherical values use selected support bounds and conservatively approximated spherical rectangle edges, so curved source arcs and selected poles remain enclosed. Latitude-degenerate point sets retain every source point on their parallel. Empty input returns a typed empty Polygon; nonempty degenerate bounds keep their Point or LineString dimension; Full remains Full.

Parameters:

Name Type Description Default
tolerance float or sequence of float

Non-negative positional accuracy target. A scalar applies to every row. Omission selects a scale-aware target for Spherical approximation; exact Planar and Chart envelopes need no refinement.

None
unit 'meters'

Unit for the Spherical approximation tolerance. The output always preserves the input's Space and epoch.

'meters'

Returns:

Type Description
GeometryArray

One XY envelope per row; missing rows remain missing.

Raises:

Type Description
InvalidGeometryError

If coordinates are non-finite or outside the spherical coordinate domain.

ResourceLimitError

If spherical boundary refinement exceeds its per-row generated-output budget.

Examples:

>>> import gometry as gm
>>> gm.LineString([(0, 0), (3, 1)]).envelope().to_wkt()
'POLYGON ((0 0, 3 0, 3 1, 0 1, 0 0))'

estimate_local_crs

estimate_local_crs() -> CRS

Estimate one conformal metric CRS for all present rows.

Missing rows are ignored. The complete present extent is evaluated against a fixed 0.1% linear scale-error ceiling; empty/all-missing, CRS-free, or geographically unsafe arrays raise CRSError.

Returns:

Type Description
CRS

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.Point(-122.4, 37.8, space=gm.Space(crs=4326))])
>>> arr.estimate_local_crs()
CRS("EPSG:32610")

extremes

Accepted call forms
extremes() -> Extremes[GeometryArray[Point]]
extremes() -> Extremes[GeometryArray[Point | None]]

Return the west, south, east, and north extreme vertices of the geometry (numeric X/Y; ties keep the first vertex in storage order).

Returns:

Type Description
Extremes

Four row-aligned Point arrays as (west, south, east, north). Missing rows stay missing in every column; empty rows degrade to an empty point per column.

Examples:

>>> import gometry as gm
>>> extremes = gm.box(0, 0, 2, 4).extremes()
>>> assert extremes is not None  # None only for an empty geometry
>>> (extremes.west.to_wkt(), extremes.north.to_wkt())
('POINT (0 0)', 'POINT (2 4)')

fill_missing

Accepted call forms
fill_missing(
    value: GeometryOtherT,
) -> GeometryArray[GeometryT | GeometryOtherT]
fill_missing(
    value: GeometryArray[GeometryOtherT | None],
) -> GeometryArray[GeometryT | GeometryOtherT]

Return a new array with every missing row replaced by value.

Parameters:

Name Type Description Default
value Geometry or GeometryArray

A scalar fill geometry, or a row-aligned array whose values fill the matching missing rows. Only masked rows are consumed from an array fill value; every consumed row must be present.

required

Returns:

Type Description
GeometryArray

A dense array (no missing rows); the input unchanged (and returned as-is when already dense).

Raises:

Type Description
CRSMismatchError

If value's CRS or coordinate-epoch metadata conflicts with the array's.

GeometryError

If an array fill value has a different length or contains missing geometries at rows this array needs.

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.Point(0, 0), None])
>>> arr.fill_missing(gm.Point(9, 9)).to_wkt()[1]
'POINT (9 9)'

force_2d

force_2d() -> Self

Drop Z and M ordinates, preserving geometry type and CRS. Already-2D input is returned unchanged.

Returns:

Type Description
GeometryArray

One XY-only geometry per row (kinds preserved).

See Also

force_3d : Add a Z ordinate, filling missing vertices.

Examples:

>>> import gometry as gm
>>> gm.from_wkt('POINT Z (1 2 3)').force_2d().to_wkt()
'POINT (1 2)'

force_3d

force_3d(z: float = 0.0) -> Self

Make each geometry 3D, filling vertices that lack Z with z. Vertices that already carry Z keep it; M passes through.

Parameters:

Name Type Description Default
z float

Finite Z to assign where it is missing.

0.0

Returns:

Type Description
GeometryArray

One 3D geometry per row (kinds preserved).

Raises:

Type Description
InvalidGeometryError

If z is not finite.

See Also

force_2d : Drop Z and M to plain XY. with_coordinates : Replace individual coordinate ordinates.

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.Point(1, 2)])
>>> arr.force_3d().to_wkt()[0]
'POINT Z (1 2 0)'

index

index(value: object, start: int = 0, stop: int | None = None) -> int

First index of a structurally equal element in [start, stop) (list.index semantics, using Geometry.eq: same CRS, epoch, and exact geometry; negative bounds count from the end).

Parameters:

Name Type Description Default
value Geometry

The element to locate.

required
start int

First position searched.

0
stop int

One past the last position searched (the array length when omitted).

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no element in the window equals value.

interpolate_m

interpolate_m(
    start_m: FloatInput,
    end_m: FloatInput,
    *,
    overwrite: bool = False,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> Self

Assign M ordinates by cumulative length along the retained linework.

M runs from start_m to end_m across all parts, with no distance added between parts. The selected metric measures the source curves without changing them or rescaling the supplied M range. It determines the stored values, not how M is later evaluated between vertices.

Every vertex, its X/Y and Z, and the Space are preserved. Existing M requires overwrite=True. A zero-length X/Y segment has equal M values at both ends. Empty linework stays empty and gains an M axis.

Parameters:

Name Type Description Default
start_m float or sequence of float

The measure range (finite, end_m >= start_m) — a scalar applies to every geometry, or pass one value per geometry.

required
end_m float or sequence of float

The measure range (finite, end_m >= start_m) — a scalar applies to every geometry, or pass one value per geometry.

required
overwrite bool

Replace existing M ordinates instead of raising.

False
metric 'cartesian'

None uses the default metric for the Space. 'cartesian' requires Planar Space; Sphere() or Sphere(radius) selects a spherical measuring surface for a geographic CRS.

'cartesian'

Returns:

Type Description
GeometryArray

One result per row, preserving geometry kinds and missing rows.

Raises:

Type Description
GeometryTypeError

If the geometry is not lineal.

InvalidGeometryError

If the linework carries M without overwrite.

GeometryError

If the measure range is invalid.

See Also

line_interpolate : Point at a distance or M location along the line. line_substring : Extract a contiguous portion of the line. line_locate : Locate the nearest route position on the line.

Examples:

>>> import gometry as gm
>>> line = gm.LineString([(0, 0), (10, 0)])
>>> line.interpolate_m(0.0, 100.0).to_wkt()
'LINESTRING M (0 0 0, 10 0 100)'

line_interpolate

Accepted call forms
line_interpolate(
    at: ListArray[NDArray[float64] | NDArray[int64]],
    *,
    basis: Literal['distance'] = 'distance',
    count: None = None,
    normalized: bool = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> ListArray[GeometryArray[Point]]
line_interpolate(
    at: ListArray[NDArray[float64] | NDArray[int64] | None],
    *,
    basis: Literal['distance'] = 'distance',
    count: None = None,
    normalized: bool = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> ListArray[GeometryArray[Point] | None]
line_interpolate(
    at: ListArray[NDArray[float64] | NDArray[int64]],
    *,
    basis: Literal['m'],
    count: None = None,
    normalized: Literal[False] = False,
    unit: None = None,
    metric: None = None,
) -> ListArray[GeometryArray[Point]]
line_interpolate(
    at: ListArray[NDArray[float64] | NDArray[int64] | None],
    *,
    basis: Literal['m'],
    count: None = None,
    normalized: Literal[False] = False,
    unit: None = None,
    metric: None = None,
) -> ListArray[GeometryArray[Point] | None]
line_interpolate(
    at: FloatInput,
    *,
    basis: Literal['distance'] = 'distance',
    count: None = None,
    normalized: bool = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point]
line_interpolate(
    at: FloatInput,
    *,
    basis: Literal['distance'] = 'distance',
    count: None = None,
    normalized: bool = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point | None]
line_interpolate(
    at: None = None,
    *,
    count: int
    | integer[Any]
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Iterable[int]
    | Buffer,
    basis: Literal['distance'] = 'distance',
    normalized: Literal[False] = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> ListArray[GeometryArray[Point]]
line_interpolate(
    at: None = None,
    *,
    count: int
    | integer[Any]
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Iterable[int]
    | Buffer,
    basis: Literal['distance'] = 'distance',
    normalized: Literal[False] = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> ListArray[GeometryArray[Point] | None]
line_interpolate(
    at: FloatInput,
    *,
    count: None = None,
    basis: Literal['m'],
    normalized: Literal[False] = False,
    unit: None = None,
    metric: None = None,
) -> GeometryArray[Point]
line_interpolate(
    at: FloatInput,
    *,
    count: None = None,
    basis: Literal['m'],
    normalized: Literal[False] = False,
    unit: None = None,
    metric: None = None,
) -> GeometryArray[Point | None]

Interpolate point locations along linework. Empty linework yields POINT EMPTY at every location.

Distance-basis routes retain vertices at zero-length X/Y segments. At an interior prefix shared by such a run, an exact boundary selects its first stored vertex; normalized 0 and 1 select the first and last stored vertices. M-basis interpolation follows the stored monotonic measure and keeps vertices whose active Z/M ordinates differ even when X/Y is equal.

Distance stations follow cumulative length on the retained source edges under the selected metric. An independently interpolated geographic point uses canonical longitude; original endpoints retain their stored spelling.

Parameters:

Name Type Description Default
at float or sequence of float

One location or many explicit distance-basis locations. Under basis='m', pass one stored M value for a scalar result or a sequence of stored M values for one line; an array accepts one M value per row.

For an array, numeric ListArray supplies a separate sequence of explicit locations per route, for either basis. Group count must match array length.

Empty station groups produce empty point groups; missing routes or station groups produce missing groups. Empty routes yield one empty point per station. A plain numeric sequence stays flat, including an empty sequence; only ListArray selects per-route groups.

required
count int or iterable of int

Number of evenly spaced distance-basis samples per row (>= 1) along the selected metric. A scalar broadcasts; otherwise pass one count per row. Mutually exclusive with at and unavailable with basis='m'; normalized=True is invalid because count already supplies fractional positions.

None
basis ('distance', 'm')

Use CRS-aware distance, or the line's monotonic M ordinate. Distance forms omit basis; M stationing requires basis='m' and inverts the stored measure using the source edge's ordinate parameterization.

'distance'
normalized bool

Interpret distance-basis at values as fractions of the route length under the selected metric. Changing metric can change their positions. Invalid with basis='m'.

False
metric 'cartesian'

Measuring surface for distance stationing. With None, use the geometry's default metric. An override is unavailable with basis='m'.

'cartesian'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement. Available only with basis='distance'; invalid with basis='m'.

'meters'

Returns:

Type Description
GeometryArray[Point] or ListArray[GeometryArray[Point]]

One point per row for scalar or row-aligned at; one point group per row for count samples or numeric ListArray of explicit stations.

Raises:

Type Description
GeometryTypeError

If the geometry is not lineal.

InvalidGeometryError

If M values are missing or non-monotonic. Array failures identify the original input row.

GeometryError

If input forms conflict, a value is non-finite, or a distance-only option is used with basis='m'.

ResourceLimitError

If count exceeds the generated-output budget.

See Also

line_locate : Locate the nearest route position; repeated support makes the inverse non-unique. line_substring : Extract a contiguous portion of the line. interpolate_m : Assign M ordinates along arc length.

Examples:

>>> import gometry as gm
>>> line = gm.LineString([(0, 0), (10, 0)])
>>> line.line_interpolate(4).to_wkt()
'POINT (4 0)'

line_locate

Accepted call forms
line_locate(
    point: Point | GeometryArray[Point | None],
    *,
    basis: Literal['m'],
    normalized: Literal[False] = False,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: None = None,
) -> NDArray[float64]
line_locate(
    point: Point | GeometryArray[Point | None],
    *,
    basis: Literal['distance'] = 'distance',
    normalized: bool = False,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> NDArray[float64]

Locate the position on linework nearest point. Empty linework, or an empty query point, locates to nan.

Projection is in X/Y. Zero-length X/Y segments add no distance-basis projection. Planar distance-basis locate selects the exactly nearest segment; exact ties prefer an interior projection over an endpoint, then the first segment in route order, matching planar proximity. Geographic locate applies the same role and source order when evaluated backend distances compare equal. It ranks available measurements, including the chart projection trial, rather than asserting an exact geodesic minimum. With basis='m', the returned M is taken from the selected projection.

The Space defines the route: Planar segments retain their literal coordinate paths, Chart segments follow the longitude/latitude chart, and Spherical segments follow great-circle arcs. The selected metric measures that route without changing it.

Parameters:

Name Type Description Default
point Point or GeometryArray[Point | None]

A point to project, or one point per line row. Missing query rows produce nan in the result column.

required
basis ('distance', 'm')

Return a CRS-aware distance, or the line's monotonic M ordinate. Distance forms omit basis; M stationing requires basis='m'. The selected metric chooses the nearest projection. Its source M is interpolated by coordinate fraction in Planar Space, or original-CRS ellipsoidal arclength in Chart/Spherical Space, independently of a selected Sphere.

'distance'
normalized bool

Return a distance-basis fraction in [0, 1] under the selected metric. Changing metric can change the nearest projection and returned fraction. Invalid with basis='m'.

False
metric 'cartesian'

None uses the CRS metric. 'cartesian' requires Planar Space. Sphere() or Sphere(radius) selects a physical sphere on a geographic CRS. Available with either basis; it does not reinterpret the route or change the source M field.

'cartesian'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement. Available only with basis='distance'; invalid with basis='m'.

'meters'

Returns:

Type Description
ndarray

One location per line row.

Raises:

Type Description
CRSError

If the CRS cannot provide an unambiguous distance metric.

CRSMismatchError

If operands' CRS or coordinate-epoch metadata differ.

GeometryTypeError

If the geometry is not lineal.

InvalidGeometryError

If M values are missing or non-monotonic. Array failures identify the original input row.

GeometryError

If a distance-only option is used with basis='m'.

See Also

line_interpolate : Point at a route station; locate/interpolate round-trip only at a unique nearest position. line_substring : Extract a contiguous portion of the line. interpolate_m : Assign M ordinates along arc length.

Examples:

>>> import gometry as gm
>>> line = gm.LineString([(0, 0), (10, 0)])
>>> line.line_locate(gm.Point(4, 3))
4.0

line_merge

Accepted call forms
line_merge(*, directed: bool = False) -> GeometryArray[LineString]
line_merge(*, directed: bool = False) -> GeometryArray[LineString | None]
line_merge(
    *, directed: bool = False
) -> GeometryArray[LineString | MultiLineString]
line_merge(
    *, directed: bool = False
) -> GeometryArray[LineString | MultiLineString | None]

Merge connected LineString parts into longer LineStrings.

Joins occur only at degree-two endpoints, never across branching junctions. With directed=True, join only a source end to a source start: no component's coordinate order is reversed. Directed merging keeps active-distinct endpoint occurrences at a join, so different Z/M values at the same X/Y are retained as consecutive vertices. Chart and Spherical endpoints join by physical site, including seam and pole aliases. Chart publication can insert vertices to preserve authored longitude travel. Spherical merging retains the original minor great-circle arcs.

Parameters:

Name Type Description Default
directed bool

Preserve the direction of every source coordinate sequence.

False

Returns:

Type Description
GeometryArray

One merged linework per row.

Raises:

Type Description
GeometryTypeError

If the geometry is not lineal.

Examples:

>>> import gometry as gm
>>> a, b = [(0, 0), (1, 1)], [(1, 1), (2, 2)]
>>> (gm.MultiLineString([a, b]).line_merge()).to_wkt()
'LINESTRING (0 0, 1 1, 2 2)'

line_substring

Accepted call forms
line_substring(
    start: FloatInput,
    end: FloatInput,
    *,
    basis: Literal['m'],
    normalized: Literal[False] = False,
    unit: None = None,
    metric: None = None,
) -> GeometryArray[LineString | Point]
line_substring(
    start: FloatInput,
    end: FloatInput,
    *,
    basis: Literal['m'],
    normalized: Literal[False] = False,
    unit: None = None,
    metric: None = None,
) -> GeometryArray[LineString | Point | None]
line_substring(
    start: FloatInput,
    end: FloatInput,
    *,
    basis: Literal['distance'] = 'distance',
    normalized: bool = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[LineString | Point]
line_substring(
    start: FloatInput,
    end: FloatInput,
    *,
    basis: Literal['distance'] = 'distance',
    normalized: bool = False,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[LineString | Point | None]

Return the portion of linework from start through end. Empty linework yields LINESTRING EMPTY.

Both bounds are inclusive. Stored vertices at zero-length X/Y segments consume no distance but remain in the result when their active ordinates differ, including consecutive vertices with identical X/Y. This applies to distance and M basis.

Distance stations follow cumulative length on the retained source edges under the selected metric. New endpoints embedded in a retained source edge keep that edge's continuous longitude spelling.

Parameters:

Name Type Description Default
start float or sequence of float

Ordered locations on the selected basis. Distance values follow the CRS; M values are stored route measures. A scalar applies to every array row.

required
end float or sequence of float

Ordered locations on the selected basis. Distance values follow the CRS; M values are stored route measures. A scalar applies to every array row.

required
basis ('distance', 'm')

Use CRS-aware distance, or the line's monotonic M ordinate. Distance forms omit basis; M stationing requires basis='m' and inverts the stored measure using the source edge's ordinate parameterization.

'distance'
normalized bool

Interpret distance-basis positions as fractions of the route length under the selected metric. Changing metric can change the cut points. Invalid with basis='m'.

False
metric 'cartesian'

Measuring surface for distance stationing. With None, use the geometry's default metric. An override is unavailable with basis='m'.

'cartesian'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement. Available only with basis='distance'; invalid with basis='m'.

'meters'

Returns:

Type Description
GeometryArray

One substring per row.

Raises:

Type Description
GeometryTypeError

If the geometry is not lineal.

InvalidGeometryError

If M values are missing or non-monotonic. Array failures identify the original input row.

GeometryError

If locations are non-finite or out of order, or a distance-only option is used with basis='m'.

See Also

line_interpolate : Point at a location along the line. line_locate : Locate the nearest route position on the line. interpolate_m : Assign M ordinates along arc length.

Examples:

>>> import gometry as gm
>>> line = gm.LineString([(0, 0), (10, 0)])
>>> line.line_substring(2, 6).to_wkt()
'LINESTRING (2 0, 6 0)'

linearize

Accepted call forms
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[LineString]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[LineString | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[LineString]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[LineString | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[Polygon]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[Polygon | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiLineString]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiLineString | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiPolygon]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiPolygon | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiPolygon]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiPolygon | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiPolygon]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[MultiPolygon | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[Polygon]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[Polygon | None]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[Geometry]
linearize(
    *, quadrant_segments: int | None = None, max_deviation: float | None = None
) -> GeometryArray[Geometry | None]

Replace curves and surfaces with simple features.

Each circular arc becomes equal-angle chords through both of its stored endpoints, as PostGIS ST_CurveToLine produces, and Z and M vary linearly along the arc through its middle control point. CircularString and CompoundCurve become LineString; CurvePolygon and Triangle become Polygon; MultiCurve becomes MultiLineString; and MultiSurface, PolyhedralSurface and TIN become MultiPolygon. Straight-edged surfaces convert exactly, and simple features return unchanged. The Space and coordinate axes are preserved.

Parameters:

Name Type Description Default
quadrant_segments int

Chords per quarter circle, at least 1. The default is 32, as in PostGIS.

None
max_deviation float

Largest distance between an arc and its chords, in coordinate units. Pass at most one of quadrant_segments and max_deviation.

None

Returns:

Type Description
GeometryArray

One geometry per row with every arc replaced by chords.

Raises:

Type Description
GeometryError

If both parameters are given, or either is not positive.

ResourceLimitError

If the chords for a row would exceed the generated-vertex limit.

Examples:

>>> import gometry as gm
>>> arc = gm.CircularString([(0, 0), (1, 1), (2, 0)])
>>> arc.linearize(quadrant_segments=1).to_wkt()
'LINESTRING (0 0, 1 1, 2 0)'
>>> len(arc.linearize().coords)
65

make_valid

Accepted call forms
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Point]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[MultiPoint]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[
    Point | MultiPoint | LineString | MultiLineString | GeometryCollection
]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[GeometryCollection]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Point | LineString | MultiLineString]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Polygon | MultiPolygon]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Point | None]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[MultiPoint | None]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[
    Point
    | MultiPoint
    | LineString
    | MultiLineString
    | GeometryCollection
    | None
]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[GeometryCollection | None]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Point | LineString | MultiLineString | None]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Polygon | MultiPolygon | None]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Geometry]
make_valid(
    *, method: Literal['linework', 'structure'] = 'linework'
) -> GeometryArray[Geometry | None]

Repair invalid geometry, returning corrected result(s) (OGC). Already-valid input is returned unchanged at validation cost. Geographic repair checks exact quotient validity before rebuilding; when output construction needs seam vertices it splits the source while preserving traceable Z/M ordinates. Projected and CRS-free geometry remains planar. A collapsed LineString becomes a Point at its first coordinate. Collapsed MultiLineString members become a Point or MultiPoint, combined with surviving linework in a GeometryCollection when both dimensions remain.

Parameters:

Name Type Description Default
method ('linework', 'structure')

Repair strategy: linework nodes all boundary linework and selects regions from each original ring occurrence's winding modulo two before recombining each polygon's shell minus its holes; distinct polygon members are unioned. structure rebuilds each ring's nonzero-winding enclosed area and recombines it as shells minus holes.

At rebuilt vertices, Z is the occurrence-weighted mean of eligible source values; M is retained when eligible measures agree. Each axis is resolved independently, and an unavailable axis is dropped from the affected result.

'linework'

Returns:

Type Description
GeometryArray

One valid geometry per row.

Raises:

Type Description
InvalidGeometryError

If the geometry cannot be repaired.

See Also

validate : Structured validity report. is_valid : Boolean-only test.

Examples:

>>> import gometry as gm
>>> bowtie = gm.from_wkt('POLYGON ((0 0, 2 2, 2 0, 0 2, 0 0))')
>>> fixed = bowtie.make_valid()
>>> (fixed.is_valid, fixed.geometry_type)
(True, 'MultiPolygon')

map_coordinate_sequences

map_coordinate_sequences(func: Callable[[NDArray[float64]], ArrayLike]) -> Self

Map each point, line, or ring sequence independently in row order.

Uses Geometry.map_coordinate_sequences admission and callback rules, preserving each row's grouping, native ordinate schema, CRS, and epoch. Missing rows remain missing and do not invoke the callback. Errors carry the source row; callback exceptions retain their original type.

Parameters:

Name Type Description Default
func callable

Receives one read-only (N, D) float64 matrix at a time and may change N while preserving D.

required

Returns:

Type Description
GeometryArray

map_coordinates

map_coordinates(func: Callable[[NDArray[float64]], ArrayLike]) -> Self

Apply a vectorized callback to this array's coordinate matrix.

The callback receives a read-only (N, dims) float64 matrix for present rows and must return a matrix with the same shape. Non-uniform arrays (mixed-axes rows or a heterogeneous GeometryCollection) use the view's union layout with NaN padding; each member keeps its native axes on apply.

Parameters:

Name Type Description Default
func callable

Function called with the read-only coordinate matrix.

required

Returns:

Type Description
GeometryArray

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.LineString([(0, 0), (1, 1)])])
>>> arr.map_coordinates(lambda m: m + 1).to_wkt()
['LINESTRING (1 1, 2 2)']

materialize

materialize() -> Self

Return independently owned copies of the selected rows.

Row order, duplicates, missing values, geometry kinds, axes, complete Space, and selected polygon interiors are preserved. The result does not retain coordinate, validity, or prepared-product owners from the source array.

Returns:

Type Description
GeometryArray

A compact array with storage independent of the source selection.

maximum_inscribed_circle

Accepted call forms
maximum_inscribed_circle(
    *,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> CircleArray[Circle]
maximum_inscribed_circle(
    *,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> CircleArray[Circle | None]

Solve an inscribed circle of a polygonal geometry. The selected metric measures boundary clearance within the filled source support, including holes. The result retains the complete source Space. Empty support has an empty center and NaN radius. Full geographic support has an infinite radius and a deterministic center.

Parameters:

Name Type Description Default
tolerance float

Nonnegative finite absolute optimization target shared by all rows. Zero requests the highest useful fidelity; None resolves per row.

None
metric 'cartesian'

None uses the CRS metric. "cartesian" requires Planar Space; Sphere() or Sphere(radius) selects a physical sphere for geographic coordinates. The optional radius is in meters.

"cartesian"
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
CircleArray

Retained circle solutions with vectorized center and radius projections. Missing rows remain missing; empty and missing radii are NaN.

Raises:

Type Description
GeometryTypeError

If the input is not polygonal.

InvalidGeometryError

If invalid polygonal topology prevents the circle calculation.

GeometryError

If tolerance is not finite and nonnegative or the metric is not admitted.

See Also

minimum_bounding_circle : Smallest enclosing circle solution. polylabel : Approximate label anchor from a distinct floating-point search.

Examples:

>>> import gometry as gm
>>> circle = gm.box(0, 0, 2, 2).maximum_inscribed_circle()
>>> (circle.center.to_wkt(), circle.radius)
('POINT (1 1)', 1.0)
>>> circle.to_geometry().geometry_type
'Polygon'

minimum_bounding_circle

Accepted call forms
minimum_bounding_circle(
    *,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> CircleArray[Circle]
minimum_bounding_circle(
    *,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> CircleArray[Circle | None]

Solve a circle enclosing the complete represented geometry. The selected metric measures distances to source points, curves and filled regions. The retained center and realization preserve the complete source Space. Empty support has an empty center and NaN radius.

Parameters:

Name Type Description Default
tolerance float

Nonnegative finite absolute optimization target in the selected units, shared by all rows. Zero requests the highest useful fidelity.

None
metric 'cartesian'

None uses the CRS metric. "cartesian" requires Planar Space; Sphere() or Sphere(radius) selects a geographic measuring sphere.

"cartesian"
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
CircleArray

Retained circle solutions. Missing rows remain missing; numeric projections use NaN for empty and missing rows.

Raises:

Type Description
GeometryError

If the tolerance or measuring surface is invalid, or the physical disk cannot be represented on a Planar geographic source branch.

Examples:

>>> import gometry as gm
>>> circle = gm.MultiPoint([(0, 0), (4, 0)]).minimum_bounding_circle()
>>> (circle.center.to_wkt(), circle.radius)
('POINT (2 0)', 2.0)

minimum_clearance

minimum_clearance(
    *,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> NDArray[float64]

Minimum separation of original logical vertex sites and nonincident retained edges. Original sites belong to the input's closed support, including its interior. Duplicate model positions and an original edge's endpoint sites are excluded. A vertex touching an edge interior has zero clearance. Refinement introduces no sites. This feature separation is not a universal safe-edit radius.

The selected metric measures the input Space's original curves. Geographic physical distances default to meters on the CRS ellipsoid. Cartesian projected distances use native linear units; CRS-free distances use raw units. Explicit Cartesian measurement of geographic Planar input uses native angular units. No eligible pair gives infinity, including Empty, a bare Point, a duplicate-only MultiPoint and boundary-free Full. One surviving original site can still pair with nonincident retained edges whose endpoints are constructed.

Parameters:

Name Type Description Default
metric None, ``cartesian``, or Sphere

Measuring metric, independent of the input Space. Cartesian requires a planar Space; Sphere requires a geographic CRS. Omitted follows the CRS.

None
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
ndarray

One clearance distance per row; missing rows give NaN.

Examples:

>>> import gometry as gm
>>> gm.box(0, 0, 3, 2).minimum_clearance()
2.0

minimum_clearance_line

Accepted call forms
minimum_clearance_line(
    *,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[LineString]
minimum_clearance_line(
    *,
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[LineString | None]

Shortest connector realizing original-feature minimum_clearance. The metric measures the input Space's original curves; refinement creates no new clearance sites. The connector uses the same representation, admission and refinement as shortest_line and preserves the input Space. A physical connector may contain more than two coordinates when the model's edges differ from the metric geodesic.

No eligible pair gives an empty LineString; actual zero separation gives a nonempty zero-length line. Missing rows remain missing. Endpoint fields use the original source resolver. Chart and Spherical field stationing uses the original CRS ellipsoid independently of the selected measuring surface.

A physical connector with a genuine planar longitude-branch, wrapping or pole conflict raises GeometryError and requires explicit geographic conversion. Numerical minimum_clearance remains available in that case.

Parameters:

Name Type Description Default
metric None, ``cartesian``, or Sphere

Measuring metric; omitted follows the CRS. Cartesian requires planar input.

None
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
GeometryArray

One realizing line per row.

See Also

minimum_clearance : The clearance distance itself.

Examples:

>>> import gometry as gm
>>> (gm.box(0, 0, 3, 2).minimum_clearance_line()).to_wkt()
'LINESTRING (0 0, 0 2)'

minimum_rotated_rectangle

Accepted call forms
minimum_rotated_rectangle() -> GeometryArray[Point | LineString | Polygon]
minimum_rotated_rectangle() -> GeometryArray[
    Point | LineString | Polygon | None
]

Minimum-area rotated bounding rectangle. A computed areal rectangle is returned in XY. A degenerate geographic result that follows source-edge support can retain resolvable Z/M by the original edge's ellipsoidal arclength; see the geometry guide's Z/M under operations section.

Returns:

Type Description
GeometryArray

One rotated rectangle per row.

Raises:

Type Description
InvalidGeometryError

If the rotated rectangle cannot be computed.

Examples:

>>> import gometry as gm
>>> rect = gm.box(0, 0, 2, 2).minimum_rotated_rectangle()
>>> gm.equals(rect, gm.box(0, 0, 2, 2))
True

minimum_width

minimum_width(
    *,
    metric: Literal['cartesian'] | None = None,
    unit: Literal['meters'] | None = None,
) -> NDArray[float64]

Width of the narrowest parallel strip enclosing the geometry. Uses the complete convex hull, including all disconnected components. Holes do not reduce the width. This is distinct from minimum clearance and from the shorter side of the minimum-area rotated rectangle. A point or collinear support has width zero; empty input has width NaN.

Requires a planar Space and measures XY in its coordinate plane.

Parameters:

Name Type Description Default
metric 'cartesian'

Use 'cartesian' explicitly when the planar Space has a geographic CRS.

'cartesian'
unit 'meters'

None returns native coordinate units. 'meters' requires compatible linear axes in the CRS.

'meters'

Returns:

Type Description
numpy.ndarray of float

Minimum strip widths; NaN for empty and missing rows.

Raises:

Type Description
GeometryError

If the Space is not planar, the measurement metric is not Cartesian, or meters are requested without a compatible CRS.

CRSError

If CRS resolution fails.

OverflowError

If non-finite coordinates prevent the support calculation.

Examples:

>>> import gometry as gm
>>> gm.box(0, 0, 4, 2).minimum_width()
2.0

node

Accepted call forms

Node linework by splitting every edge at all intersections. Input ordinates are carried where possible; unsourceable seam vertices yield XY.

Returns:

Type Description
GeometryArray

Noded linework per row.

Raises:

Type Description
InvalidGeometryError

If noding fails on the input linework.

Examples:

>>> import gometry as gm
>>> lines = gm.MultiLineString([[(0,0),(2,0)],[(1,-1),(1,1)]])
>>> noded = lines.node()
>>> (noded.num_geometries, noded.length)
(4, 4.0)

normalize

normalize() -> Self

Return a geometry in canonical (normalized) form. The canonical form is the lexicographically smallest equivalent presentation: parts sort ascending, lines take their smaller direction (closed lines the smallest rotation), and polygon rings lead with their minimum vertex under RFC 7946 winding (exterior counter-clockwise, holes clockwise).

Returns:

Type Description
GeometryArray

The canonical form of every element (kinds preserved).

Examples:

>>> import gometry as gm
>>> messy = gm.from_wkt('MULTIPOINT ((1 1), (0 0))')
>>> messy.normalize().to_wkt()
'MULTIPOINT ((0 0), (1 1))'

offset_curve

Accepted call forms
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['raw'],
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | LineString]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['raw'],
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | LineString | None]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[
    Point | LineString | MultiPoint | MultiLineString | GeometryCollection
]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[MultiLineString | MultiPoint | GeometryCollection]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[GeometryCollection]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[
    Point
    | LineString
    | MultiPoint
    | MultiLineString
    | GeometryCollection
    | None
]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[MultiLineString | MultiPoint | GeometryCollection | None]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[GeometryCollection | None]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[
    Point | LineString | MultiPoint | MultiLineString | GeometryCollection
]
offset_curve(
    distance: FloatInput,
    *,
    join_style: Literal['round', 'miter', 'bevel'] = 'round',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    miter_limit: float = 5.0,
    mode: Literal['clean', 'raw'] = 'clean',
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[
    Point
    | LineString
    | MultiPoint
    | MultiLineString
    | GeometryCollection
    | None
]

Construct a signed line offset, keeping its visible boundary pieces by default.

Positive distance selects the source's left side; negative distance selects its right side. Clean visibility uses the whole supplied lineal geometry's two-sided styled buffer at abs(distance), with the same joins and miter limit and round line-end caps. GeometryCollection member structure, including emptied members, is retained. Array rows remain independent.

Both modes preserve Space, CRS, epoch and original-source Z/M. New cuts use original source parameters; artificial subdivisions add no attribute weight. Geographic source fields use the original CRS ellipsoid independently of a selected Sphere. A zero offset preserves the admitted source value. Available Z records are averaged at coalesced locations. M is retained only when eligible measures numerically agree; conflicts drop M from the output component independently of Z.

Parameters:

Name Type Description Default
distance float or sequence of float

Offset; sign selects the side. CRS-aware: geodesic meters on a geographic CRS, native linear units on a projected CRS, raw coordinate units when CRS-free. A scalar applies to every geometry, or pass one value per geometry. Every distance must be finite.

required
join_style ('round', 'miter', 'bevel')

Corner treatment at outside turns: 'round' inscribes fillet arcs, 'miter' extends the carriers to their crossing (clipped at miter_limit), 'bevel' connects the offsets directly.

'round'
tolerance float or None

Scalar nonnegative finite positional target in the active construction units. Automatic quality uses the sagitta of a 32-chord circle at abs(distance); zero requests highest practical fidelity.

None
miter_limit float

With join_style='miter': how far a mitered corner may reach, in multiples of abs(distance), before it is clipped flat.

5.0
mode ('clean', 'raw')

Omission selects 'clean'. 'clean' retains requested pieces on the owning geometry's styled buffer boundary; close approaches can split or hide them. 'raw' retains the untrimmed construction, including reversals, excursions and self-intersections. Visible collapsed support is returned as points rather than zero-length lines.

'clean'
metric 'cartesian'

Measuring surface. Cartesian offsets require Planar Space. Physical offsets preserve the original Chart, Spherical or Planar geographic interpretation and require the supported local carried-style domain. Global focal or repeated-wrap continuation is not supported. An unrepresentable Planar geographic branch names to_space().

'cartesian'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
GeometryArray

One offset result per row, preserving missing rows and independent visibility.

Raises:

Type Description
GeometryError

If distance, tolerance, styles, metric or units are invalid, or the requested construction is outside its supported domain or cannot preserve its Space.

ResourceLimitError

If required output or generated construction work exceeds its budget.

See Also

buffer : Offset region (optionally one-sided via side).

Examples:

>>> import gometry as gm
>>> path = gm.LineString([(0, 0), (4, 0)])
>>> shifted = path.offset_curve(1)
>>> assert shifted.space == path.space

orient_polygons

orient_polygons(*, ccw: bool = True) -> Self

Orient polygon rings to a consistent winding.

Parameters:

Name Type Description Default
ccw bool

True (default): exterior CCW, holes CW; False flips.

True

Returns:

Type Description
GeometryArray

One reoriented geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> cw = gm.Polygon([(0, 0), (0, 1), (1, 1), (1, 0)])
>>> cw.orient_polygons().exterior.is_ccw
True

point_on_surface

Accepted call forms
point_on_surface() -> GeometryArray[Point]
point_on_surface() -> GeometryArray[Point | None]

Representative point guaranteed to lie on the geometry. Geographic input crossing the antimeridian is interpreted in its declared Space. The point lies inside or on the geometry, unlike centroid. Planar and Chart polygonal scanline candidates are checked after rounding, with a source boundary point used when no candidate is covered. Spherical Space uses spherical geometry rather than treating longitude and latitude as planar coordinates. The representative is computed in XY and does not imply source Z/M. On planar polygonal input, the first polygon component wins when representative chords have equal width. A GeometryCollection uses its highest-dimensional nonempty support.

See Also

centroid : Area/length-weighted center (may fall outside). polylabel : Pole of inaccessibility (best label anchor).

Returns:

Type Description
GeometryArray[Point]

One point inside or on each row's geometry.

Raises:

Type Description
InvalidGeometryError

If a finite representative point cannot be computed.

Examples:

>>> import gometry as gm
>>> square = gm.box(0, 0, 2, 2)
>>> gm.within(square.point_on_surface(), square)
True

polygonize

Accepted call forms
polygonize() -> ListArray[GeometryArray[Polygon]]
polygonize() -> ListArray[GeometryArray[Polygon] | None]

Build polygons from a geometry's own linework, automatically noding crossings and overlaps. Each geometry is polygonized in isolation; to reconstruct polygons from a pile of edges pooled across many geometries, use free function polygonize_all on an iterable of values. Input ordinates are carried where possible; unsourceable noding seams yield XY.

Returns:

Type Description
ListArray of GeometryArray

One ragged group of polygons per input geometry, in input order; missing rows yield None groups and present empty rows yield empty groups. Each input's OWN linework is polygonized independently (row i is self[i].polygonize()). To pool ALL rows' edges into one graph so a ring can close across inputs, use the free function polygonize_all.

See Also

polygonize_all : Pool linework across all supplied geometries.

Raises:

Type Description
InvalidGeometryError

If polygons cannot be assembled from the linework.

Examples:

>>> import gometry as gm
>>> a, b = [(0, 0), (1, 0)], [(1, 0), (1, 1)]
>>> edges = gm.MultiLineString([a, b, [(1, 1), (0, 0)]])
>>> edges.polygonize().to_wkt()[0]
'POLYGON ((0 0, 1 0, 1 1, 0 0))'

polylabel

Accepted call forms
polylabel(
    *,
    tolerance: FloatInput | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point]
polylabel(
    *,
    tolerance: FloatInput | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | None]

Return an approximate most-distant point in a polygon for label placement. The selected metric measures distance to the boundary of the filled support, including holes. Geographic inputs retain their Space and use their source curves rather than a local projected optimum. Empty geometries return POINT EMPTY.

See Also

maximum_inscribed_circle : Retained inscribed circle with direct center access. centroid : Area/length-weighted center (may fall outside). point_on_surface : A representative point guaranteed on the geometry.

Parameters:

Name Type Description Default
tolerance float or sequence of float

Nonnegative finite absolute stopping target for the approximate label search, interpreted for the CRS (see unit) — a scalar applies to every geometry, or pass one value per geometry. Zero requests the highest useful fidelity. Omitted selects a scale-aware tolerance independently for each geometry.

None
metric 'cartesian'

None uses the CRS metric. "cartesian" requires Planar Space; Sphere() or Sphere(radius) selects a physical sphere for geographic coordinates. The optional radius is in meters.

"cartesian"
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement.

'meters'

Returns:

Type Description
GeometryArray[Point]

One point per row.

Raises:

Type Description
GeometryError

If an explicit tolerance is not nonnegative and finite.

InvalidGeometryError

If the pole of inaccessibility cannot be computed.

Examples:

>>> import gometry as gm
>>> gm.box(0, 0, 2, 2).polylabel().to_wkt()
'POINT (1 1)'

quantize

quantize(precision: int) -> Self

Round coordinates to a fixed number of decimal places.

Parameters:

Name Type Description Default
precision int

Decimal places to keep. Negative values round to tens, hundreds, and so on. Every present X/Y/Z/M ordinate is rounded independently, with ties to even, as with Python's round. The decimal result is rounded once to binary64.

required

Returns:

Type Description
GeometryArray

One rounded geometry per row (kinds preserved).

Raises:

Type Description
GeometryError

If a rounded coordinate is outside the finite binary64 range.

Examples:

>>> import gometry as gm
>>> gm.Point(2.3479218, 48.8589321).quantize(3).to_wkt()
'POINT (2.348 48.859)'

remove_repeated_points

remove_repeated_points(
    *,
    tolerance: FloatInput = 0.0,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> Self

Drop consecutive nearby coordinates while retaining the source path.

Candidates are measured from the last retained vertex. Deletion also checks the complete original span against its retained shortcut, including removed detail. Unresolved spans retain their vertices. Zero uses exact model positions; necessary longitude laps, directed half-turn records and pole departures survive. Retained vertices keep their own Z/M and selected polygon interiors are not reselected.

Parameters:

Name Type Description Default
tolerance float or sequence of float

Finite non-negative distance scale in the selected metric. Geographic CRSs default to meters even for Planar values; projected CRSs use native linear units and CRS-free values use raw coordinate units. A scalar applies to every geometry, or pass one value per geometry.

0.0
metric None, 'cartesian', or Sphere

Measuring surface, independently of the curve model. Cartesian requires Planar values.

None
unit None or 'meters'

Override the tolerance's distance units.

None

Returns:

Type Description
GeometryArray

One deduplicated geometry per row (kinds preserved).

Raises:

Type Description
GeometryError

If tolerance is negative or non-finite.

Examples:

>>> import gometry as gm
>>> stuttery = gm.LineString([(0, 0), (0, 0), (1, 1)])
>>> stuttery.remove_repeated_points().to_wkt()
'LINESTRING (0 0, 1 1)'

reverse

reverse() -> Self

Reverse the vertex order of a geometry. Linework retains every stored vertex and its active Z/M ordinates, including equal-X/Y vertices, in reverse order.

Returns:

Type Description
GeometryArray

One reversed geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> line = gm.LineString([(0, 0), (1, 1), (2, 2)])
>>> line.reverse().to_wkt()
'LINESTRING (2 2, 1 1, 0 0)'

rotate

rotate(
    angle: float, *, origin: Origin = 'centroid', radians: bool = False
) -> Self

Rotate a geometry about an origin.

Parameters:

Name Type Description Default
angle float

Rotation angle (degrees by default; radians if radians=True).

required
origin str or sequence of float

Transform origin: 'centroid' (default), 'center', or an (x, y) point.

'centroid'
radians bool

Interpret angle in radians instead of degrees.

False

Returns:

Type Description
GeometryArray

One transformed geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> gm.Point(1, 0).rotate(90, origin=(0, 0)).quantize(6).to_wkt()
'POINT (0 1)'

sample_points

Accepted call forms
sample_points(
    count: int
    | integer[Any]
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Iterable[int]
    | Buffer,
    *,
    seed: int
    | integer[Any]
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Iterable[int]
    | Buffer
    | Generator
    | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> ListArray[GeometryArray[Point]]
sample_points(
    count: int
    | integer[Any]
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Iterable[int]
    | Buffer,
    *,
    seed: int
    | integer[Any]
    | ndarray[tuple[()], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | ndarray[tuple[int], dtype[signedinteger[Any] | unsignedinteger[Any]]]
    | Iterable[int]
    | Buffer
    | Generator
    | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> ListArray[GeometryArray[Point] | None]

Random points on the geometry. The sample space is its highest dimension: area weighted for areal input, length weighted for lineal input, and equal weight across point atoms.

Physical sampling is uniform in surface area or along the retained curve's physical arclength. Planar keeps literal coordinate-plane paths and longitude sheets, Chart keeps its lifted coordinate paths, and Spherical keeps its great-circle arcs. Geographic coordinates default to the CRS ellipsoid.

An explicit metric selects another measurement surface without changing the source Space or its stored paths. Sampling has no unit option: it has no distance-valued output or threshold, so a constant unit rescaling cancels from its weights.

metric='cartesian' requires Planar Space and uses literal coordinate-plane measure. For example, a horizontal Planar line from 170° to -170° contributes 340 coordinate units, not the 20° seam crossing of a Chart line.

Each logical member contributes separately, so overlapping members retain their sampling multiplicity. A zero-area polygon falls back to its linework, and zero-length linework falls back to vertices, like centroid.

An integer seed reproduces the same points for the same input and measure. A broadcast seed derives distinct streams by logical row index; row zero agrees with a scalar call. An explicit seed for a row uses the scalar stream for that seed.

An empty geometry has nothing to sample and yields no points. Results retain the input Space. Sampled points are new XY locations, so they have no source Z/M.

Parameters:

Name Type Description Default
count int or iterable of int

Number of points to draw per row (>= 0). A scalar broadcasts; otherwise pass one count per row.

required
seed int, iterable of int, numpy.random.Generator, or None

Seed for the deterministic sample stream. A scalar derives a distinct stream for every row; otherwise pass one explicit seed per row. A Generator advances once per call. None uses fresh entropy.

None
metric 'cartesian'

None uses the CRS metric. "cartesian" requires Planar Space; Sphere() or Sphere(radius) selects a physical sphere for geographic coordinates. Sphere() uses the CRS authalic radius; an explicit positive finite radius is in meters.

"cartesian"

Returns:

Type Description
ListArray

One GeometryArray of count sampled points per row.

Raises:

Type Description
GeometryError

If count or seed is invalid.

ResourceLimitError

If count exceeds the generated-output budget.

Examples:

>>> import gometry as gm
>>> square = gm.box(0, 0, 10, 10)
>>> pts = square.sample_points(5, seed=42)
>>> (len(pts), all(p is not None and gm.within(p, square) for p in pts))
(5, True)

scale

scale(
    x_factor: float,
    y_factor: float | None = None,
    *,
    origin: Origin = 'centroid',
) -> Self

Scale a geometry about an origin.

Parameters:

Name Type Description Default
x_factor float

Scale factors along the X and Y axes; y_factor defaults to x_factor.

required
y_factor float

Scale factors along the X and Y axes; y_factor defaults to x_factor.

required
origin str or sequence of float

Transform origin: 'centroid' (default), 'center', or an (x, y) point.

'centroid'

Returns:

Type Description
GeometryArray

One transformed geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> gm.box(0, 0, 1, 1).scale(2, 2, origin=(0, 0)).bounds
(0.0, 0.0, 2.0, 2.0)

segmentize

Accepted call forms
segmentize(
    max_length: FloatInput,
    /,
    *,
    fraction: None = None,
    path: None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> Self
segmentize(
    max_length: FloatInput,
    /,
    *,
    fraction: None = None,
    path: Literal['geodesic', 'rhumb'],
    metric: Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> Self
segmentize(
    max_length: None = None,
    /,
    *,
    fraction: FloatInput,
    path: None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: None = None,
) -> Self
segmentize(
    max_length: None = None,
    /,
    *,
    fraction: FloatInput,
    path: Literal['geodesic', 'rhumb'],
    metric: Sphere | None = None,
    unit: None = None,
) -> Self

Insert vertices along stored edges or explicitly selected routes.

By default, subdivision follows the source Space's edges, measured under metric. path='geodesic' or path='rhumb' instead samples a route between each pair of original vertices. The result reconnects those samples using the source Space's edge model.

Projected geometries use native linear units, and CRS-free geometries use raw coordinate units.

Every original vertex survives unchanged — this operation only inserts. Consecutive equal-X/Y vertices with distinct active Z/M ordinates remain in their stored order; their zero-length segments are not subdivided.

Parameters:

Name Type Description Default
max_length float or sequence of float

Positive maximum segment length, interpreted for the CRS (see unit) — a scalar applies to every geometry, or pass one value per geometry. Pass this positional argument or use fraction, but not both.

None
fraction float or sequence of float

Fraction in (0, 1] of each source segment. Keyword-only; a scalar applies to every geometry, or pass one value per geometry.

required
path ('geodesic', 'rhumb')

Route for inserted geographic vertices. None keeps each stored edge; 'geodesic' follows the shortest route on the measuring surface and is planar for projected or CRS-free inputs; 'rhumb' follows a constant-bearing route and requires a geographic CRS. fraction is measured along the selected route.

'geodesic'
metric 'cartesian'

Measuring surface. None uses the CRS metric; 'cartesian' requires Planar Space. Sphere() selects the CRS authalic sphere and Sphere(radius) selects a positive finite radius in meters. An explicit route cannot be combined with 'cartesian'.

'cartesian'
unit 'meters'

None uses the selected metric's natural units. 'meters' requests meter output when the CRS and metric have compatible axes; Sphere metrics already use meters. Use metric='cartesian' to select coordinate-plane measurement. The override applies only to max_length; fraction has no unit and cannot be combined with unit. Physical route distances are meters.

'meters'

Returns:

Type Description
GeometryArray

One segmentized geometry per row (kinds preserved).

Raises:

Type Description
CRSError

If unit='meters' is requested and the CRS lacks linear axis units, or path='rhumb' is requested without a geographic CRS.

GeometryError

If neither or both constraints are supplied, max_length is not a positive finite number, fraction is outside (0, 1], unit is combined with fraction, an explicit route uses metric='cartesian', or unit='meters' is requested for a CRS-free geometry.

OverflowError

If endpoint-preserving binary64 output cannot satisfy max_length.

ResourceLimitError

If generated coordinates exceed the output budget.

Examples:

>>> import gometry as gm
>>> gm.LineString([(0, 0), (4, 0)]).segmentize(2).to_wkt()
'LINESTRING (0 0, 2 0, 4 0)'
>>> # On a geographic CRS the bound is meters along the ellipsoid.
>>> line = gm.LineString([(0, 0), (1, 0)], space=gm.Space(crs=4326))
>>> len(list(line.segmentize(20_000).coords))
7

segments

Accepted call forms
segments() -> ListArray[GeometryArray[LineString] | None]

Consecutive vertex pairs per source geometry.

Each group contains that row's line and ring segments, including closing edges, without joining parts or rings. Point and empty rows have empty groups; missing rows remain missing. Ordinates, CRS, and epoch are retained.

Returns:

Type Description
ListArray[GeometryArray[LineString] | None]

self_intersections

Accepted call forms
self_intersections() -> ListArray[GeometryArray[Point]]
self_intersections() -> ListArray[GeometryArray[Point] | None]

Return points where the geometry coincides with itself. Reports proper linework self-crossings, non-adjacent touches, the endpoints of collinear overlaps (spikes and backtracks), contact between distinct parts, and duplicate point coordinates; legal adjacent shared vertices, ring closures, and removable repeated consecutive vertices are not nodes. For point/lineal input the result is non-empty exactly when is_simple is False; areal input diagnoses its rings' linework, and collections are diagnosed recursively. Geographic diagnostics follow the CRS longitude quotient; projected and CRS-free geometry remains planar. Points are XY only.

Returns:

Type Description
ListArray

One GeometryArray of distinct self-intersection points per element; missing rows yield None groups.

Examples:

>>> import gometry as gm
>>> cross = gm.from_wkt('LINESTRING (0 0, 1 1, 1 0, 0 1)')
>>> cross.self_intersections().to_wkt()
['POINT (0.5 0.5)']

simplify

simplify(
    tolerance: FloatInput,
    *,
    method: Literal['vw', 'dp'] = 'vw',
    preserve_topology: bool = True,
    metric: Literal['cartesian'] | Sphere | None = None,
    unit: Literal['meters'] | None = None,
) -> Self

Simplify a geometry, dropping vertices below a tolerance. Two algorithms, selected by method, both reading tolerance on the same distance scale:

  • 'vw' (Visvalingam-Whyatt, the default) removes the least visually significant vertices first — the smallest effective triangle spanned with its two neighbors — for a smoother, more natural cartographic result. The effective-area threshold is tolerance**2 / 2.
  • 'dp' (Douglas-Peucker) uses distance to a retained shortcut. In spherical Space, each removal bounds the complete original normal-arc window, including arcs whose intermediate vertices were removed earlier.

Geographic VW measures the smaller physical filling of each deviation cycle on the selected surface, retaining literal Planar, periodic Chart, or spherical normal-arc edges. Geographic Planar and Chart DP use conservative chart-unit tolerance conversion. Conservative retention can keep extra vertices, especially near the poles. VW is an effective-area criterion, not a maximum-displacement guarantee. Retained vertices keep their qualified Z/M fields. Simplified spherical curves use canonical native XY.

Parameters:

Name Type Description Default
tolerance float or sequence of float

Distance scale of removable detail in the selected metric's units. The default uses meters for geographic CRSs, native linear units for projected CRSs, and raw coordinate units when CRS-free. A scalar applies to every geometry, or pass one value per geometry.

required
method ('vw', 'dp')

'vw' is area-based (Visvalingam-Whyatt); 'dp' is distance- based (Douglas-Peucker).

'vw'
preserve_topology bool

Preserve valid, non-collapsed components and their contacts, connectivity and containment within each geometry, including nested collection and point members. Extra vertices may be retained to preserve these relationships. Separate array rows are simplified independently. False permits topology changes.

True
metric 'cartesian'

Select the measuring surface without changing stored coordinates or Space. Geographic CRSs use their ellipsoid by default; Sphere selects a sphere. 'cartesian' is available only in planar Space.

'cartesian'
unit 'meters'

Override the resolved metric's tolerance scale. 'meters' requires a CRS and expresses the tolerance in meters.

'meters'

Returns:

Type Description
GeometryArray

One simplified geometry per row (kinds preserved).

Raises:

Type Description
GeometryError

If tolerance is negative or non-finite.

CRSError

If a physical metric cannot be resolved, or geographic coordinates are outside their native latitude domain.

See Also

coverage_simplify : Topology-preserving simplification across a polygonal coverage.

Examples:

>>> import gometry as gm
>>> wiggly = gm.LineString([(0, 0), (1, 0.1), (2, -0.1), (3, 0)])
>>> (wiggly.simplify(1.0)).to_wkt()
'LINESTRING (0 0, 3 0)'

skew

skew(
    x_angle: float = 0.0,
    y_angle: float = 0.0,
    *,
    origin: Origin = 'centroid',
    radians: bool = False,
) -> Self

Skew (shear) a geometry about an origin.

Parameters:

Name Type Description Default
x_angle float

Shear angles along the X and Y axes (degrees by default; radians if radians=True).

0.0
y_angle float

Shear angles along the X and Y axes (degrees by default; radians if radians=True).

0.0
origin str or sequence of float

Transform origin: 'centroid' (default), 'center', or an (x, y) point.

'centroid'
radians bool

Interpret x_angle/y_angle in radians instead of degrees.

False

Returns:

Type Description
GeometryArray

One transformed geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> gm.Point(0, 2).skew(x_angle=45, origin=(0, 0)).quantize(6).to_wkt()
'POINT (2 2)'

smooth

smooth(
    *,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    method: Literal['chaikin', 'catmull_rom'] = 'chaikin',
    keep_endpoints: bool = True,
) -> Self

Smooth line and polygon boundary linework (planar). Two algorithms, selected by method:

  • 'chaikin' (the default) samples quadratic spans between neighboring edge midpoints. Open lines honor keep_endpoints; polygon rings are always treated as cyclic.
  • 'catmull_rom' samples a centripetal cubic through every original vertex, regardless of keep_endpoints.

Parameters:

Name Type Description Default
tolerance float

One finite non-negative XY positional target in native coordinate units. None selects an automatic target independently for each curve; zero requests best-effort refinement.

None
method ('chaikin', 'catmull_rom')

'chaikin' uses quadratic spans; 'catmull_rom' uses a centripetal interpolating cubic.

'chaikin'
keep_endpoints bool

For open lines under 'chaikin', hold the first and last vertices fixed. Rings are cyclic; Catmull-Rom always retains its control points.

True

Returns:

Type Description
GeometryArray

One smoothed geometry per row (kinds preserved).

Raises:

Type Description
GeometryError

If tolerance is negative or non-finite, or the Space is nonplanar.

Examples:

>>> import gometry as gm
>>> square = gm.box(0, 0, 1, 1)
>>> square.smooth().area < square.area
True

snap_to_grid

Accepted call forms
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: Literal[False] = False,
) -> GeometryArray[GeometryT]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[Point]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[MultiPoint]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[MultiLineString]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[GeometryCollection]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[LineString | MultiLineString]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[Polygon | MultiPolygon]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: Literal[False] = False,
) -> GeometryArray[GeometryT | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[Point | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[MultiPoint | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[MultiLineString | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[GeometryCollection | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[LineString | MultiLineString | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool,
) -> GeometryArray[Polygon | MultiPolygon | None]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool = False,
) -> GeometryArray[Geometry]
snap_to_grid(
    grid_size: float | tuple[float, float] | Iterable[float],
    *,
    origin: GridOrigin = (0.0, 0.0),
    repair: bool = False,
) -> GeometryArray[Geometry | None]

Snap every coordinate onto a regular grid and clean the result. X/Y move to the nearest origin + k * grid_size grid node; consecutive duplicate vertices collapse, and parts that degenerate below their minimum become empty (the PostGIS ST_SnapToGrid shape — output may be non-simple). Z/M ride on surviving vertices. quantize is the decimal-rounding, vertex-preserving sibling.

Parameters:

Name Type Description Default
grid_size float or tuple of float

Positive finite coordinate-space grid spacing — native angular units for geographic CRSs, native linear units for projected CRSs, and raw coordinate units when CRS-free. Pass one value for a square grid or (sx, sy). Zero is invalid here; coverage_clean(grid_size=0) instead disables snapping.

required
origin tuple of float

A grid node anchoring the lattice.

(0.0, 0.0)
repair bool

If True, guarantee a valid result: snap, linework-repair, and re- snap to a fixpoint. The geometry kind may change (a Polygon whose snapped shell pinches splits into a MultiPolygon). Geographic repair=True validates the exact quotient result; projected and CRS-free geometry remains planar.

False

Returns:

Type Description
GeometryArray

One snapped geometry per row.

Raises:

Type Description
GeometryError

If grid_size or origin is invalid, or a nearest grid coordinate cannot be represented as a finite float.

InvalidGeometryError

If repair=True and repair would have to invent Z/M ordinates, or the snap-repair loop cannot converge.

Examples:

>>> import gometry as gm
>>> jittery = gm.LineString([(0.12, 0.88), (2.49, 1.51)])
>>> jittery.snap_to_grid(grid_size=0.5).to_wkt()
'LINESTRING (0 1, 2.5 1.5)'

sort_by_spatial_key

sort_by_spatial_key(
    *,
    curve: Literal['hilbert', 'morton'] = 'hilbert',
    level: int = 16,
    bounds: Iterable[float] | None = None,
) -> Self

Return the array reordered along a space-filling curve.

Parameters:

Name Type Description Default
curve ('hilbert', 'morton')

hilbert prioritizes locality; morton uses Z-order.

'hilbert'
level int

Curve depth (1-32).

16
bounds iterable[float]

Ordered (minx, miny, maxx, maxy) rectangle for keying. When omitted, uses the present rows' minimum and maximum stored coordinates without periodic wrapping. Geographic total_bounds may wrap, so it is not necessarily a curve frame.

None

Returns:

Type Description
GeometryArray

A new array with the same rows in curve-key order; empty and missing rows sort last.

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.Point(1, 0), gm.Point(0, 0)])
>>> arr.sort_by_spatial_key().to_wkt()
['POINT (0 0)', 'POINT (1 0)']

spatial_key

spatial_key(
    *,
    curve: Literal['hilbert', 'morton'] = 'hilbert',
    level: int = 16,
    bounds: Iterable[float] | None = None,
) -> NDArray[uint64]

Space-filling-curve key of each geometry's bbox center. Discretizes centers into a 2^level x 2^level grid over bounds and returns distances along the selected curve.

Parameters:

Name Type Description Default
curve ('hilbert', 'morton')

hilbert prioritizes locality; morton uses Z-order.

'hilbert'
level int

Grid order (1 to 32); 16 matches GeoPandas/DuckDB.

16
bounds tuple of float

Ordered (minx, miny, maxx, maxy) rectangle for keying. When omitted, uses the present rows' minimum and maximum stored coordinates without periodic wrapping. Geographic total_bounds may wrap, so it is not necessarily a curve frame. Keys compare across geometries only against a shared frame — pass the same bounds when keying separate geometries.

None

Returns:

Type Description
ndarray

One result per row. Empty and missing rows use uint64.max and therefore sort last.

Raises:

Type Description
GeometryError

If level or bounds is invalid.

Examples:

>>> import gometry as gm
>>> keys = gm.GeometryArray([gm.Point(0, 0), gm.Point(10, 10)]).spatial_key(bounds=(0, 0, 10, 10))
>>> bool(keys[0] != keys[1])
True

subdivide

Accepted call forms
subdivide(*, max_vertices: int = 256) -> ListArray[GeometryArray[Geometry]]
subdivide(
    *, max_vertices: int = 256
) -> ListArray[GeometryArray[Geometry] | None]

Split geometry into parts of bounded complexity. Recursively clips across the longer axis until every part has at most max_vertices coordinates (the PostGIS ST_Subdivide shape). Spherical linework and Chart linework whose admitted longitude branch cannot use a literal rectangular cut are divided at source vertices, as is linework with no representable cut. Parts cover the input up to binary64 rounding at constructed cut vertices. Source ordinates are carried where meaningful; synthesized clip vertices use the operation's natural XY result. On geographic input, recursively generated cut vertices remain traced to their original source edges, including across seam pieces; they are not re-interpolated from an edge fragment created by an earlier cut.

Parameters:

Name Type Description Default
max_vertices int

Maximum coordinates per part (at least 8).

256

Returns:

Type Description
ListArray of GeometryArray

One ragged group of parts per input geometry, in input order (row i is self[i].subdivide(...)).

Raises:

Type Description
GeometryError

If max_vertices is below 8.

OverflowError

If exact partitioning cannot produce parts within the requested bound.

ResourceLimitError

If generated output exceeds its budget.

Examples:

>>> import gometry as gm
>>> parts = gm.LineString([(i, 0) for i in range(20)]).subdivide(max_vertices=8)
>>> len(parts)
4

swap_xy

swap_xy() -> Self

Swap the X and Y ordinate of every coordinate (Z/M untouched). The axis- order repair for data delivered latitude-first: gometry is always (x, y) = (lon, lat), so latitude-ordered input swaps once on ingest.

Returns:

Type Description
GeometryArray

One swapped geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> latitude_first = gm.Point(52.5, 13.4)
>>> latitude_first.swap_xy().to_wkt()
'POINT (13.4 52.5)'

to_arrow

to_arrow(*, encoding: Literal['auto', 'wkb'] = 'auto') -> PyArrowArray

Export the array as a GeoArrow array.

Geographic export follows Geometry.to_arrow finite-drawing rules. A cut can promote a homogeneous line or polygon column to its multi-part family. Missing rows, CRS and coordinate epoch are retained.

Parameters:

Name Type Description Default
encoding ('auto', 'wkb')

auto exports homogeneous arrays as their native GeoArrow layout and falls back to WKB for mixed geometry types; wkb always exports a GeoArrow WKB array.

'auto'

Returns:

Type Description
object

A GeoArrow-compatible array.

See Also

from_arrow : Decode a GeoArrow array into a GeometryArray.

Examples:

>>> import gometry as gm
>>> type(gm.GeometryArray([gm.Point(1, 2)]).to_arrow()).__name__
'ExtensionArray'

to_geojson

Accepted call forms
to_geojson() -> list[str]
to_geojson() -> list[str | None]

Serialize Planar coordinates as GeoJSON text. GeoJSON uses OGC:CRS84 longitude/latitude order under RFC 7946 and carries no source CRS label. CRS-tagged input must use the 2D WGS 84 geographic family (EPSG:4326 or OGC:CRS84) or the 3D longitude/latitude/height family (EPSG:4979 or OGC:CRS84h); reproject other CRS values first. CRS-free input is explicitly assumed to already be WGS84 longitude/latitude. Coordinates outside longitude [-180, 180] or latitude [-90, 90] are rejected. Antimeridian-crossing Planar segments retain their stored endpoints; this writer does not split or densify them. Convert Chart or Spherical values to Planar Space before export.

Unsupported Z/M axes raise an error rather than being silently discarded. Remove them explicitly with force_2d(), with_coordinates(z=None), or with_coordinates(m=None).

GeoJSON cannot represent M; drop it with with_coordinates(m=None) (or force_2d()).

Coordinate epoch is not represented in GeoJSON.

Returns:

Type Description
list of str

One GeoJSON geometry string per row; missing rows yield None.

Raises:

Type Description
CRSError

If the input carries a CRS outside the 2D/3D WGS84 longitude/latitude family.

InvalidGeometryError

If input carries M ordinates; drop them with with_coordinates(m=None) (or force_2d()).

GeometryError

If coordinates cannot be represented in GeoJSON.";

See Also

from_geojson : Parse GeoJSON back into a geometry.

Examples:

>>> import gometry as gm
>>> gm.Point(1, 2).to_geojson()
'{"type":"Point","coordinates":[1.0,2.0]}'

to_geopandas

to_geopandas() -> GeoPandasSeries

Convert this array to a GeoPandas GeoSeries through vectorized WKB.

Returns:

Type Description
object

A planar GeoPandas GeoSeries carrying this array's CRS.

Raises:

Type Description
GeometryError

If this array does not have Planar Space; GeoPandas cannot retain gometry's spherical or chart curves and selected global regions.

ModuleNotFoundError

If GeoPandas is not installed.

Examples:

>>> import gometry as gm
>>> type(gm.GeometryArray([gm.Point(1, 2, space=gm.Space(crs=4326))]).to_geopandas()).__name__
'GeoSeries'

to_geoparquet

to_geoparquet(
    path: str | PathLike[str] | BinaryIO | PyArrowNativeFile,
    *,
    attributes: PyArrowTable | Mapping[str, Any] | None = None,
    encoding: Literal['wkb', 'geoarrow', 'geometry'] = 'wkb',
    **kwargs: Any,
) -> None

Write this array to a GeoParquet file, optionally as a feature table.

Parameters:

Name Type Description Default
path str, path-like, or binary stream

Output Parquet path or caller-owned binary writable stream. Text streams are not supported; the writer leaves streams open.

required
attributes Table or mapping

Per-row attribute columns written beside the geometry column (lengths must match).

None
encoding str

'wkb' (portable default) and 'geoarrow' (separated coordinates for homogeneous arrays) write GeoParquet 1.1 with a bbox covering. 'geometry' writes native Parquet GEOMETRY with GeoParquet 2.0 metadata, including M ordinates. Geographic conversion may canonicalize longitude aliases, split parts and add rounded vertices or pole closures. All modes use finite planar drawings, not geodesic curves or a promise of identical source-point incidence.

"wkb"
kwargs mapping

Additional options forwarded to pyarrow.parquet.write_table.

{}

Raises:

Type Description
GeometryError

If the encoding is unknown, attributes clash with the geometry column or mismatch the row count, or a GeoParquet 1.1 encoding carries M. Use encoding='geometry' to preserve M, or explicitly remove it with with_coordinates(m=None).

Examples:

>>> import gometry as gm
>>> import tempfile, os
>>> path = tempfile.mktemp(suffix='.parquet')
>>> gm.GeometryArray([gm.Point(1, 2, space=gm.Space(crs=4326))]).to_geoparquet(path)
>>> os.path.getsize(path) > 0
True

to_numpy

to_numpy() -> NDArray[object_]

Export the array as a numpy.ndarray of typed geometry objects.

Returns:

Type Description
ndarray

One typed leaf geometry per row.

Examples:

>>> import gometry as gm
>>> gm.GeometryArray([gm.Point(1, 2)]).to_numpy()[0].to_wkt()
'POINT (1 2)'

to_pandas

to_pandas(
    *, index: Any | None = None, name: Hashable | None = None
) -> PandasSeries

Build a pandas Series backed by gometry's concrete extension dtype.

Parameters:

Name Type Description Default
index sequence or Index

Forwarded to pandas.Series.

None
name hashable

Series name.

None

Returns:

Type Description
object

A pandas Series sharing this geometry array.

Raises:

Type Description
ModuleNotFoundError

If pandas is not installed.

Examples:

>>> import gometry as gm
>>> type(gm.GeometryArray([gm.Point(1, 2, space=gm.Space(crs=4326))]).to_pandas()).__name__
'Series'

to_polars

to_polars(
    *, name: str = 'geometry', srids: Mapping[int, CrsInput] | None = None
) -> PolarsSeries

Encode this array as a Polars binary (E)WKB Series.

Encodable EPSG and wire-alias identifiers are embedded; other CRSs, coordinate epochs and curve models require explicit restoration.

Parameters:

Name Type Description Default
name str

Output Series name.

"geometry"
srids mapping[int, CRS - like]

Validate an emitted nonzero SRID in this destination namespace. A missing identifier or incompatible CRS raises.

None

Returns:

Type Description
object

A Polars Series containing WKB or EWKB values.

Raises:

Type Description
GeometryError

If a selected region has no WKB representation.

CRSError

If srids does not resolve the emitted SRID or cannot be checked against a CRS-free array.

CRSMismatchError

If the mapped destination CRS differs from the array CRS.

TypeError

If srids is not a mapping from integer identifiers to CRS values.

ModuleNotFoundError

If Polars is not installed.

Examples:

>>> import gometry as gm
>>> type(gm.GeometryArray([gm.Point(1, 2, space=gm.Space(crs=4326))]).to_polars()).__name__
'Series'

to_polyline

Accepted call forms
to_polyline(*, precision: int = 5) -> list[str]
to_polyline(*, precision: int = 5) -> list[str | None]

Encode every LineString or Point row as Google polyline text (see Geometry.to_polyline). Unsupported Z/M axes raise an error rather than being silently discarded. Remove them explicitly with force_2d(), with_coordinates(z=None), or with_coordinates(m=None).

Parameters:

Name Type Description Default
precision int

Decimal digits encoded per ordinate (0 to 11).

5

Returns:

Type Description
list of str or None

One encoded polyline per row, with None at missing rows.

Raises:

Type Description
GeometryTypeError

If a row is not a LineString or Point.

CRSError

If the CRS is set and is not EPSG:4326 longitude/latitude.

InvalidGeometryError

If a row carries Z/M, or a coordinate is outside the longitude/latitude domain. Flatten explicitly with force_2d().

GeometryError

If precision is out of range.

See Also

from_polyline : Decode Google polyline text into geometries.

Examples:

>>> import gometry as gm
>>> gm.GeometryArray([gm.LineString([(0, 0), (1, 1)])]).to_polyline()
['??_ibE_ibE']

to_space

Accepted call forms
to_space(
    space: Space,
    *,
    area_of_interest: CrsAreaInput | None = None,
    authority: str | None = None,
    accuracy: FloatScalar | ScalarFloatArray | None = None,
    allow_ballpark: bool | None = None,
    only_best: bool | None = None,
    force_over: bool = False,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point]
to_space(
    space: Space,
    *,
    area_of_interest: CrsAreaInput | None = None,
    authority: str | None = None,
    accuracy: FloatScalar | ScalarFloatArray | None = None,
    allow_ballpark: bool | None = None,
    only_best: bool | None = None,
    force_over: bool = False,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Point | None]
to_space(
    space: Space,
    *,
    area_of_interest: CrsAreaInput | None = None,
    authority: str | None = None,
    accuracy: FloatScalar | ScalarFloatArray | None = None,
    allow_ballpark: bool | None = None,
    only_best: bool | None = None,
    force_over: bool = False,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Geometry]
to_space(
    space: Space,
    *,
    area_of_interest: CrsAreaInput | None = None,
    authority: str | None = None,
    accuracy: FloatScalar | ScalarFloatArray | None = None,
    allow_ballpark: bool | None = None,
    only_best: bool | None = None,
    force_over: bool = False,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Geometry | None]

Transform every represented row into a target Space.

Curves are refined when the target cannot represent their coordinate image directly. Polygon shell/hole ownership and selected interiors are carried through the transformation. Present row kinds may change; row order, missing rows and GeometryCollection member structure remain. Empty and all-missing arrays retain the exact requested Space.

Parameters:

Name Type Description Default
space Space

Complete target interpretation, including CRS, model and epoch.

required
area_of_interest sequence of float

Bounding (west, south, east, north) used to select a coordinate operation.

None
authority str

Restrict candidate coordinate operations to this authority.

None
accuracy float

Maximum acceptable coordinate-operation accuracy, in meters.

None
allow_ballpark bool

Allow low-accuracy ballpark operations when no precise one exists.

None
only_best bool

Use only the single best operation; no fallback.

None
force_over bool

Preserve coordinates on the source side of the antimeridian instead of wrapping them into [-180, 180].

False
tolerance float

Nonnegative target-space error target for representing transformed curves. Omission selects the operation's default target.

None
unit 'meters'

Interpret tolerance in meters. Without this option, the target CRS's natural distance units apply.

"meters"

Returns:

Type Description
GeometryArray

The transformed rows in the requested Space. Present row kinds may change; missing rows remain missing.

Raises:

Type Description
CRSError

If present rows require transformation but exactly one endpoint lacks CRS metadata, or unit='meters' requires a target CRS with a known length unit.

TransformError

If no coordinate operation exists or a represented path cannot be transformed continuously.

GeometryError

If a present row or selected region cannot be represented in the target model, tolerance is negative or nonfinite, or unit is unsupported. Row errors identify the logical row.

to_space_vertices

to_space_vertices(
    space: Space,
    *,
    area_of_interest: CrsAreaInput | None = None,
    authority: str | None = None,
    accuracy: FloatScalar | ScalarFloatArray | None = None,
    allow_ballpark: bool | None = None,
    only_best: bool | None = None,
    force_over: bool = False,
) -> Self

Transform stored vertices into a complete target Space.

Geometry kind, component layout, row order and missingness are preserved. Intervening curves are reconnected between transformed vertices without approximation, so this method does not claim shape preservation. Target model admission checks geographic coordinates, spherical edges and selected polygon regions.

Z follows the coordinate operation's computed output and remains an ordinate when the target CRS is 2D. A 2D source CRS cannot feed a geocentric target from a carried Z alone; the source Space must declare a physical 3D CRS and the geometry must contain Z. Geocentric source Z participates in transformed X/Y; a geocentric source without Z cannot supply a 2D target.

Parameters:

Name Type Description Default
space Space

Complete target interpretation, including CRS, model and epoch.

required
area_of_interest sequence of float

Bounding (west, south, east, north) used to select a coordinate operation.

None
authority str

Restrict candidate coordinate operations to this authority.

None
accuracy float

Maximum acceptable coordinate-operation accuracy, in meters.

None
allow_ballpark bool

Allow low-accuracy ballpark operations when no precise one exists.

None
only_best bool

Use only the single best operation; no fallback.

None
force_over bool

Preserve coordinates on the source side of the antimeridian instead of wrapping them into [-180, 180].

False

Returns:

Type Description
GeometryArray

The transformed rows in the requested Space. Empty and all-missing arrays retain that exact target Space.

Raises:

Type Description
CRSError

If present rows require transformation but exactly one endpoint lacks CRS metadata.

TransformError

If no coordinate operation exists or it fails to apply.

GeometryError

If a present row is inadmissible in the target model. The error identifies its logical row.

to_wkb

Accepted call forms
to_wkb(
    *,
    srid: Literal['auto'] | SupportsIndex | None = None,
    srids: Mapping[int, CrsInput] | None = None,
    convention: Literal['left', 'smaller', 'postgis_geography'] | None = None,
) -> list[bytes]
to_wkb(
    *,
    srid: Literal['auto'] | SupportsIndex | None = None,
    srids: Mapping[int, CrsInput] | None = None,
    convention: Literal['left', 'smaller', 'postgis_geography'] | None = None,
) -> list[bytes | None]

Serialize to Well-Known Binary.

Unsupported Z/M axes raise an error rather than being silently discarded. Remove them explicitly with force_2d(), with_coordinates(z=None), or with_coordinates(m=None).

Parameters:

Name Type Description Default
srid None, 'auto', or int

Omit the identifier, select the value's explicit EPSG or PostGIS wire-alias code, or emit the supplied destination identifier (including zero).

None
srids mapping[int, CRS - like]

Validate an emitted nonzero identifier in this destination namespace against the geometry CRS. Under postgis_geography, mapping values describe catalog CRSs whose effective payload axes are degrees. Supplying a mapping does not change coordinates.

None
convention ('left', 'smaller', 'postgis_geography')

Encode geographic polygon boundaries under a declared ring convention. "left" preserves the selected region by orienting each boundary; "smaller" rejects regions the reader would not recover; and "postgis_geography" checks PostGIS's source convention and boundary roles. Geographic conventions do not reinterpret Planar values.

"left"

Returns:

Type Description
list of bytes

One WKB payload per row; missing rows yield None.

Notes

The coordinate epoch is not representable in (E)WKB and does not survive a round-trip; use Arrow interchange when the epoch matters.

Raises:

Type Description
GeometryError

If the selected region cannot be represented by the requested convention, a convention is unsupported or conflicts with the selected Space, or the string value of srid is not 'auto'.

InvalidGeometryError

If convention="smaller" requires scoring an invalid geographic ring.

CRSError

If convention="postgis_geography" requires a non-degree or non-geographic payload frame; if srid='auto' has no supported wire SRID; or if srids cannot resolve the emitted identifier or verify a CRS-free value.

CRSMismatchError

If the destination namespace maps the emitted identifier to a different CRS.

TypeError

If srids is not a mapping from integer identifiers to CRS values.

OverflowError

If srid is outside the unsigned 32-bit range.

See Also

from_wkb : Parse WKB/EWKB back into a geometry.

Examples:

>>> import gometry as gm
>>> pt = gm.Point(1, 2)
>>> pt.to_wkt() == gm.from_wkb(pt.to_wkb()).to_wkt()
True

to_wkb_column

to_wkb_column(
    *,
    srid: Literal['auto'] | SupportsIndex | None = None,
    srids: Mapping[int, CrsInput] | None = None,
    convention: Literal['left', 'smaller', 'postgis_geography'] | None = None,
) -> SupportsArrowArray

Encode an owning nullable Arrow large-binary column of WKB or EWKB.

Uses the same SRID and checked boundary convention as to_wkb, without allocating Python bytes per row. Missing rows remain null, not empty geometries.

Parameters:

Name Type Description Default
srid int, "auto", or None

Embed an explicit identifier, select the encodable authority ID, or omit it.

None
srids mapping[int, CRS - like]

Check the selected destination identifier against this database namespace. No unused entries are resolved and no coordinates are transformed.

None
convention ('left', 'smaller', 'postgis_geography')

Encode the selected ring region for the receiving system. Use postgis_geography for a degree-based spherical geography column.

"left"

Returns:

Type Description
object

An Arrow C array provider owning nullable large-binary WKB values. The column has no GeoArrow extension label, Space, or epoch metadata.

See Also

GeometryArray.to_wkb : Encode the same rows into a Python list.

to_wkt

Accepted call forms
to_wkt(
    *,
    srid: Literal['auto'] | SupportsIndex | None = None,
    srids: Mapping[int, CrsInput] | None = None,
    convention: Literal['left', 'smaller', 'postgis_geography'] | None = None,
) -> list[str]
to_wkt(
    *,
    srid: Literal['auto'] | SupportsIndex | None = None,
    srids: Mapping[int, CrsInput] | None = None,
    convention: Literal['left', 'smaller', 'postgis_geography'] | None = None,
) -> list[str | None]

Serialize to Well-Known Text.

Unsupported Z/M axes raise an error rather than being silently discarded. Remove them explicitly with force_2d(), with_coordinates(z=None), or with_coordinates(m=None).

Parameters:

Name Type Description Default
srid None, 'auto', or int

Omit the identifier, select the value's explicit EPSG or PostGIS wire-alias code, or emit the supplied destination identifier (including zero).

None
srids mapping[int, CRS - like]

Validate an emitted nonzero identifier in this destination namespace against the geometry CRS. Under postgis_geography, mapping values describe catalog CRSs whose effective payload axes are degrees. Supplying a mapping does not change coordinates.

None
convention ('left', 'smaller', 'postgis_geography')

Encode geographic polygon boundaries under a declared ring convention. "left" preserves the selected region by orienting each boundary; "smaller" rejects regions the reader would not recover; and "postgis_geography" checks PostGIS's source convention and boundary roles. Geographic conventions do not reinterpret Planar values.

"left"

Returns:

Type Description
list of str

One WKT string per row; missing rows yield None.

Raises:

Type Description
GeometryError

If the selected region cannot be represented by the requested convention, a convention is unsupported or conflicts with the selected Space, or the string value of srid is not 'auto'.

InvalidGeometryError

If convention="smaller" requires scoring an invalid geographic ring.

CRSError

If convention="postgis_geography" requires a non-degree or non-geographic payload frame; if srid='auto' has no supported wire SRID; or if srids cannot resolve the emitted identifier or verify a CRS-free value.

CRSMismatchError

If the destination namespace maps the emitted identifier to a different CRS.

TypeError

If srids is not a mapping from integer identifiers to CRS values.

OverflowError

If srid is outside the unsigned 32-bit range.

See Also

from_wkt : Parse WKT back into a geometry.

Examples:

>>> import gometry as gm
>>> gm.Point(1.5, 2.5).to_wkt()
'POINT (1.5 2.5)'
>>> gm.GeometryArray([gm.Point(1.5, 2.5)]).to_wkt()
['POINT (1.5 2.5)']

translate

translate(x_offset: float, y_offset: float) -> Self

Translate a geometry by (x_offset, y_offset).

Parameters:

Name Type Description Default
x_offset float

Offsets along the X and Y axes.

required
y_offset float

Offsets along the X and Y axes.

required

Returns:

Type Description
GeometryArray

One transformed geometry per row (kinds preserved).

Examples:

>>> import gometry as gm
>>> gm.Point(1, 2).translate(10, 20).to_wkt()
'POINT (11 22)'

triangulate

Accepted call forms
triangulate(
    *,
    method: Literal['earcut'],
    metric: Literal['cartesian'] | Sphere | None = None,
    tolerance: None = None,
    min_angle: None = None,
    max_area: None = None,
) -> ListArray[GeometryArray[Polygon]]
triangulate(
    *,
    method: Literal['earcut'],
    metric: Literal['cartesian'] | Sphere | None = None,
    tolerance: None = None,
    min_angle: None = None,
    max_area: None = None,
) -> ListArray[GeometryArray[Polygon] | None]
triangulate(
    *,
    method: Literal['delaunay'],
    metric: Literal['cartesian'] | Sphere | None = None,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    min_angle: None = None,
    max_area: None = None,
) -> ListArray[GeometryArray[Polygon]]
triangulate(
    *,
    method: Literal['delaunay'],
    metric: Literal['cartesian'] | Sphere | None = None,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    min_angle: None = None,
    max_area: None = None,
) -> ListArray[GeometryArray[Polygon] | None]
triangulate(
    *,
    method: Literal['constrained'],
    metric: Literal['cartesian'] | Sphere | None = None,
    tolerance: None = None,
    min_angle: FloatInput | None = None,
    max_area: FloatInput | None = None,
) -> ListArray[GeometryArray[Polygon]]
triangulate(
    *,
    method: Literal['constrained'],
    metric: Literal['cartesian'] | Sphere | None = None,
    tolerance: None = None,
    min_angle: FloatInput | None = None,
    max_area: FloatInput | None = None,
) -> ListArray[GeometryArray[Polygon] | None]

Triangulate each geometry with an explicit algorithm.

Point-site Delaunay uses the Planar coordinate plane or Spherical great-circle model; Chart point sites must be converted to Planar or Spherical Space. Region Earcut and constrained triangulation retain the source Space and edge model. Selecting a Sphere for a geographic region does not reinterpret its source edges or source ordinates.

Parameters:

Name Type Description Default
method ('earcut', 'delaunay', 'constrained')

Required triangulation algorithm. Delaunay methods resolve exact cocircular ties with a canonical rule keyed by lexicographic XY coordinates, independent of insertion order.

'earcut'
metric 'cartesian'

One selection applies to every row. For point-site Delaunay, None follows the Space model: Planar uses Cartesian and Spherical uses great-circle distance; Chart point sites are unsupported. For region operations, None uses the CRS-native metric while retaining the source model, including geographic-CRS Planar regions. "cartesian" requires Planar Space. Sphere() or Sphere(radius) requires a geographic CRS and selects spherical physical measurements without changing source edges or ordinates; point-site Delaunay also requires Spherical Space. The default radius is authalic; an explicit radius is in meters. Delaunay adjacency is radius-independent.

"cartesian"
tolerance float

One nonnegative point-site accuracy target for every row, in coordinate units for Planar Space or meters for Spherical Space. Valid with method='delaunay'. Original corners and the source predicates' full numerical precision are retained for every target. Zero requests the highest useful accuracy; distinct sites are never snapped.

None
min_angle float or sequence of float

Minimum triangle angle in degrees; each value must be finite and in [0, 180]. Zero disables the angle target. Valid only with method='constrained'.

None
max_area float or sequence of float

Maximum area in the selected metric; each value must be positive and finite. Cartesian uses squared coordinate units; physical geographic metrics use square meters. Valid only with method='constrained'.

Setting either option enables refinement; inserted Steiner vertices return uniform XY.

Each row makes area progress independently of an unattainable angle target, retaining a complete valid mesh and its constrained boundaries. Targets are best effort. Boundary samples follow retained source curves; shared edges use the same samples. Scalar and array rows use the same first-occurrence source-site and ordinate policy.

None

Returns:

Type Description
ListArray of GeometryArray[Polygon]

One ragged triangle group per input geometry. Delaunay methods return counter-clockwise triangles starting at their smallest XY corner, sorted by corner coordinates within each group.

Raises:

Type Description
GeometryError

If a quality constraint is invalid or method-specific options are used with the wrong algorithm.

CRSError

If a row's Space model and selected construction metric are incompatible.

OverflowError

If a boundary Steiner point cannot be represented at float resolution; operation is 'triangulate'.

ResourceLimitError

If refinement exceeds the generated-output budget.

InvalidGeometryError

If an input polygon is invalid or its triangulation cannot be constructed.

Examples:

>>> import gometry as gm
>>> groups = gm.GeometryArray([gm.box(0, 0, 2, 2)]).triangulate(method='earcut')
>>> groups[0].to_wkt()
['POLYGON ((0 2, 0 0, 2 0, 0 2))', 'POLYGON ((2 2, 0 2, 2 0, 2 2))']

unique_points

Accepted call forms
unique_points() -> GeometryArray[MultiPoint]
unique_points() -> GeometryArray[MultiPoint | None]
unique_points() -> GeometryArray[MultiPoint | GeometryCollection | None]

Distinct vertices in first-occurrence order. Vertices compare by exact structural identity (every active ordinate by bit pattern, the equals_identical notion), so XYZ points that differ only in Z stay distinct.

Returns:

Type Description
GeometryArray

One distinct-vertex result per row: a MultiPoint for homogeneous rows or a GeometryCollection of ordered Point members for heterogeneous rows.

Notes

A heterogeneous result follows ordinary GeometryCollection semantics: is_simple is false by convention and structural equality remains type-sensitive. Mixed-axis and collection exports use WKB for Arrow interchange; see Arrow & storage.

See Also

remove_repeated_points : Collapse consecutive duplicate vertices in place, keeping the geometry kind.

Examples:

>>> import gometry as gm
>>> loop = gm.LineString([(0, 0), (1, 1), (0, 0), (2, 2)])
>>> loop.unique_points().to_wkt()
'MULTIPOINT ((0 0), (1 1), (2 2))'

validate

Accepted call forms
validate() -> list[ValidationReport]
validate() -> list[ValidationReport | None]

Structured validity report in the geometry's coordinate frame. Geographic validity reads exact quotient topology, so period aliases and seam cuts do not depend on their stored longitude spelling. An out-of-domain latitude is reported as latitude_out_of_range; geographic operations that require coordinate admission still raise.

For quotient-topology issues, the location is a canonical coordinate of the issue's contact set, chosen deterministically by minimum latitude then longitude.

Projected and CRS-free geometry uses ordinary planar OGC validity. A nonempty LineString with fewer than two distinct XY positions is invalid and reports line_collapsed.

Returns:

Type Description
list of ValidationReport

One report per row; missing rows are None.

See Also

is_valid : Boolean-only test. repair : Fix what the report diagnoses.

Examples:

>>> import gometry as gm
>>> bowtie = gm.from_wkt('POLYGON ((0 0, 2 2, 2 0, 0 2, 0 0))')
>>> report = bowtie.validate()
>>> (report.is_valid, report.reason)
(False, 'exterior ring has a self-intersection')

voronoi

Accepted call forms
voronoi(
    *,
    output: Literal['polygons'] = 'polygons',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    clip: Polygon | MultiPolygon | None = None,
) -> ListArray[GeometryArray[Polygon | MultiPolygon]]
voronoi(
    *,
    output: Literal['polygons'] = 'polygons',
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    clip: Polygon | MultiPolygon | None = None,
) -> ListArray[GeometryArray[Polygon | MultiPolygon] | None]
voronoi(
    *,
    output: Literal['edges'],
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    clip: Polygon | MultiPolygon | None = None,
) -> ListArray[GeometryArray[LineString]]
voronoi(
    *,
    output: Literal['edges'],
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
    clip: Polygon | MultiPolygon | None = None,
) -> ListArray[GeometryArray[LineString] | None]

Construct a Voronoi diagram from the geometry's vertices.

Planar sites use Cartesian distance in their coordinate plane, including when they have a geographic CRS. Spherical sites use great-circle distance over the whole surface. Chart sites require conversion to a Planar or Spherical Space. Outputs retain the sites' complete Space.

Distinct sites retain first-occurrence order. A clipped cell with no area remains a typed empty cell in that position. One spherical site owns Full or the supplied clip. Shared cell boundaries are published once and reused by both adjacent cells.

Parameters:

Name Type Description Default
output ('polygons', 'edges')

Return clipped Voronoi cells or the internal Voronoi edges. The polygon form omits output; edge output requires output='edges' and excludes the clip polygon's exterior boundary.

'polygons'
tolerance float or None

Finite nonnegative publication target in meters for Spherical sites. None selects the automatic target of 0.1 meters; zero requests the highest useful accuracy. The target guides refinement, not site snapping or merging, and is not a guaranteed error bound. Planar diagrams already use their fixed construction precision and do not require refinement.

None
metric 'cartesian'

None selects the model-defined distance. 'cartesian' requires Planar Space; a Sphere requires Spherical Space. The sphere radius affects meter-valued accuracy, not the ideal diagram.

'cartesian'
clip Polygon or MultiPolygon

Restrict the diagram to this region in the same complete Space. None selects the padded coordinate domain for Planar sites or the complete surface for Spherical sites. A clip can disconnect or remove a cell; its vertices do not become sites or source-field contributors.

None

Returns:

Type Description
ListArray[GeometryArray[Polygon | MultiPolygon]] or ListArray[GeometryArray[LineString]]

One ragged group of the selected output per input geometry, in input order.

Raises:

Type Description
OverflowError

If the output cannot be represented in binary64.

ResourceLimitError

If generated output or the embedding search exceeds its budget.

InvalidGeometryError

If the clip or constructed diagram cannot be admitted for publication.

GeometryError

If the input is in Chart Space or the selected metric does not match the model.

Examples:

>>> import gometry as gm
>>> sites = gm.MultiPoint([(0, 0), (2, 0), (1, 2)])
>>> len(sites.voronoi())
3
>>> len(sites.voronoi(output='edges'))
3

with_coordinates

Accepted call forms
with_coordinates(
    coordinates: Sequence[Sequence[float]]
    | ndarray[
        tuple[int, int],
        dtype[
            floating[Any] | signedinteger[Any] | unsignedinteger[Any] | bool_
        ],
    ]
    | Coordinates,
    /,
) -> Self
with_coordinates(
    coordinates: None = None,
    /,
    *,
    x: FloatScalar | ScalarFloatArray | FloatColumn = ...,
    y: FloatScalar | ScalarFloatArray | FloatColumn = ...,
    z: FloatScalar | ScalarFloatArray | FloatColumn | None = ...,
    m: FloatScalar | ScalarFloatArray | FloatColumn | None = ...,
) -> Self

Return an array with selected coordinate ordinates replaced.

Pass one (N, dims) matrix (including a Coordinates view), or replace any of x=, y=, z=, and m= by a scalar or a column over the flattened coordinate sequence. Omitted ordinates are preserved. z=None and m=None remove those dimensions; X and Y cannot be removed. Missing rows contribute no coordinates and remain missing. Matrix and column modes cannot be mixed. Calling without arguments returns an unchanged value.

Parameters:

Name Type Description Default
coordinates sequence of float

Replacement (N, dims) coordinate matrix, including a Coordinates view.

None
x float, sequence of float, or None

Replace one ordinate by a scalar broadcast over vertices or a column with one value per coordinate. Omitted ordinates are preserved. None removes Z or M and is not valid for X or Y.

...
y float, sequence of float, or None

Replace one ordinate by a scalar broadcast over vertices or a column with one value per coordinate. Omitted ordinates are preserved. None removes Z or M and is not valid for X or Y.

...
z float, sequence of float, or None

Replace one ordinate by a scalar broadcast over vertices or a column with one value per coordinate. Omitted ordinates are preserved. None removes Z or M and is not valid for X or Y.

...
m float, sequence of float, or None

Replace one ordinate by a scalar broadcast over vertices or a column with one value per coordinate. Omitted ordinates are preserved. None removes Z or M and is not valid for X or Y.

...

Returns:

Type Description
GeometryArray

Examples:

>>> import gometry as gm
>>> arr = gm.GeometryArray([gm.LineString([(0, 0), (1, 1)])])
>>> arr.with_coordinates([(5, 5), (6, 6)]).to_wkt()
['LINESTRING (5 5, 6 6)']

with_space

with_space(space: Space, *, overwrite: bool = False) -> Self

Reinterpret every row in one complete Space without moving coordinates.

Geometry kinds, axes, row order and missingness are preserved, including on empty or all-missing columns. Changed interpretation acquires fresh computational products while sharing immutable coordinate storage. Planar polygon rings first entering a geographic model select their left side. Existing geographic polygon sides survive Chart/Spherical changes. A Planar target drops those sides only when each shell and hole selects its bounded planar region.

Parameters:

Name Type Description Default
space Space

Complete target interpretation, including CRS, model and epoch.

required
overwrite bool

Allow replacing a present, different CRS or epoch. Attaching, clearing and restating metadata, or changing only the model, need no flag.

False

Returns:

Type Description
GeometryArray

Raises:

Type Description
CRSError

If a present CRS or epoch would change without overwrite=True.

GeometryError

If a present row is outside the target geographic domain or contains an undefined antipodal spherical edge, or has Full or an unrepresentable selected ring support under a Planar target. The error identifies its row.

Examples:

>>> import gometry as gm
>>> gm.GeometryArray([gm.Point(1, 2)]).with_space(gm.Space(crs=4326)).crs
CRS("EPSG:4326")