Skip to content

Geometry types

The seven simple-feature classes, the eight curve and surface classes, and the members unique to each type. Shared operations live on Geometry.

Related: Geometry · Curves & surfaces

Simple features

Point

Accepted call forms
Point(
    x: None = None,
    y: None = None,
    *,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> Point
Point(
    x: Point | Iterable[float],
    y: None = None,
    *,
    z: FloatScalar | ScalarFloatArray | None = None,
    m: FloatScalar | ScalarFloatArray | None = None,
    space: Space | None = None,
) -> Point
Point(
    x: FloatScalar | ScalarFloatArray,
    y: FloatScalar | ScalarFloatArray,
    *,
    z: FloatScalar | ScalarFloatArray | None = None,
    m: FloatScalar | ScalarFloatArray | None = None,
    space: Space | None = None,
) -> Point

A single point geometry.

Parameters:

Name Type Description Default
x None | Point | Iterable[float] | FloatScalar | ScalarFloatArray

A Point to copy, one finite coordinate value, or the X coordinate. Omit both coordinates for an empty point.

varies by call form
y None | FloatScalar | ScalarFloatArray

Finite Y coordinate when x is a scalar. Omit it when x is a coordinate value or existing Point.

varies by call form
z None | FloatScalar | ScalarFloatArray | None

Z ordinate (adds a 3D dimension).

Z (elevation) ordinate, producing an XYZ or XYZM point.

None
m None | FloatScalar | ScalarFloatArray | None

M (measure) ordinate.

M (measure) ordinate, producing an XYM or XYZM point.

None
space Space | None

Assign this Space to raw coordinates. An existing Point keeps its Space and must match the supplied Space.

Complete interpretation, assigned to raw coordinates and checked against native inputs. Omission preserves native context or defaults raw coordinates to unreferenced planar. Coordinates are not transformed.

None

Create a Point geometry — XY, XYZ, XYM, or XYZM.

Pass one coordinate value or separate x/y scalars. A coordinate of length two, three, or four means XY, XYZ, or XYZM. Pass m= to build XYM; to build many points use points.

Returns:

Type Description
Point

A point geometry — empty when x/y are omitted.

Raises:

Type Description
InvalidGeometryError

If any coordinate is not finite.

CRSMismatchError

If native input frames conflict with the selected Space.

GeometryError

If native input models conflict with the selected Space.

Examples:

>>> import gometry as gm
>>> gm.Point(1, 2).to_wkt()
'POINT (1 2)'
>>> gm.Point(1, 2, z=3).to_wkt()
'POINT Z (1 2 3)'
>>> gm.Point(1, 2, m=9).to_wkt()
'POINT M (1 2 9)'
>>> gm.Point((1, 2, 3, 9)).to_wkt()
'POINT ZM (1 2 3 9)'
>>> gm.Point(13.4, 52.5, space=gm.Space(crs=4326)).crs
CRS("EPSG:4326")
>>> gm.Point().to_wkt()
'POINT EMPTY'

m property

m: float

M (measure) ordinate.

Returns:

Type Description
float

The M measure value; it is not converted using CRS units.

Raises:

Type Description
GeometryTypeError

If the point has no M ordinate.

AttributeError

If the point is empty (POINT EMPTY).

parts property

Lazy view over this geometry's top-level parts.

Simple geometries expose themselves as a one-row view; multipart and collection geometries expose their members. GeometryArray(geom.parts) materializes them as an array.

Returns:

Type Description
GeometryParts

x property

x: float

X coordinate of the point.

Returns:

Type Description
float

The X ordinate in the geometry's coordinate units.

Raises:

Type Description
AttributeError

If the point is empty (POINT EMPTY).

y property

y: float

Y coordinate of the point.

Returns:

Type Description
float

The Y ordinate in the geometry's coordinate units.

Raises:

Type Description
AttributeError

If the point is empty (POINT EMPTY).

z property

z: float

Z (elevation) ordinate.

Returns:

Type Description
float

The Z ordinate in the geometry's coordinate units.

Raises:

Type Description
GeometryTypeError

If the point has no Z ordinate.

AttributeError

If the point is empty (POINT EMPTY).

destination

Accepted call forms
destination(
    bearing: ScalarFloatArray,
    distance: FloatScalar | ScalarFloatArray,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> Point
destination(
    bearing: FloatScalar | ScalarFloatArray,
    distance: ScalarFloatArray,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> Point
destination(
    bearing: FloatScalar | ScalarFloatArray,
    distance: FloatScalar | ScalarFloatArray,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> Point
destination(
    bearing: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    distance: FloatScalar | ScalarFloatArray,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: FloatScalar | ScalarFloatArray,
    distance: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    distance: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: FloatInput,
    distance: FloatInput,
    *,
    path: Literal['geodesic'] = 'geodesic',
    unit: Literal['meters'] | None = None,
    metric: Literal['cartesian'] | Sphere | None = None,
) -> Point | GeometryArray[Point]
destination(
    bearing: ScalarFloatArray,
    distance: FloatScalar | ScalarFloatArray,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> Point
destination(
    bearing: FloatScalar | ScalarFloatArray,
    distance: ScalarFloatArray,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> Point
destination(
    bearing: FloatScalar | ScalarFloatArray,
    distance: FloatScalar | ScalarFloatArray,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> Point
destination(
    bearing: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    distance: FloatScalar | ScalarFloatArray,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: FloatScalar | ScalarFloatArray,
    distance: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    distance: FloatColumn
    | ndarray[
        tuple[int],
        dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]],
    ],
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> GeometryArray[Point]
destination(
    bearing: FloatInput,
    distance: FloatInput,
    *,
    path: Literal['rhumb'],
    unit: Literal['meters'] | None = None,
    metric: Sphere | None = None,
) -> Point | GeometryArray[Point]

Walk from this 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
Point or GeometryArray[Point]

The destination point, or one destination per bearing or distance.

Raises:

Type Description
GeometryError

If bearing or distance is invalid.

CRSError

If the selected route requires an unavailable CRS metric.

InvalidGeometryError

If a coordinate is outside the longitude/latitude domain.

Examples:

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

MultiPoint

Accepted call forms
MultiPoint(
    coordinates: None = None,
    *,
    x: None = None,
    y: None = None,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> MultiPoint
MultiPoint(
    coordinates: Iterable[Point | Iterable[float]],
    *,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> MultiPoint
MultiPoint(
    coordinates: Iterable[Iterable[float]] | Coordinates,
    *,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> MultiPoint
MultiPoint(
    coordinates: None = None,
    *,
    x: FloatColumn,
    y: FloatColumn,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> MultiPoint

A collection of points.

Parameters:

Name Type Description Default
coordinates None | Iterable[Point | Iterable[float]] | Iterable[Iterable[float]] | Coordinates

The member points; omitted builds an empty multipoint.

Member coordinate tuples (x, y[, z[, m]]). Mutually exclusive with the x/y column form. Omit all inputs for an empty multipoint.

varies by call form
x None | FloatColumn

Column form: parallel ordinate arrays, one entry per point.

Per-point X and Y ordinates as parallel columns, as an alternative to coordinates. Both are required together.

varies by call form
y None | FloatColumn

Column form: parallel ordinate arrays, one entry per point.

Per-point X and Y ordinates as parallel columns, as an alternative to coordinates. Both are required together.

varies by call form
z None | FloatColumn | None

Column form: parallel ordinate arrays, one entry per point.

Per-point Z and M ordinates, as an alternative to inline tuples.

None
m None | FloatColumn | None

Column form: parallel ordinate arrays, one entry per point.

Per-point Z and M ordinates, as an alternative to inline tuples.

None
space Space | None

Assign this Space to raw coordinates. Existing points must share the resulting Space.

Complete interpretation, assigned to raw coordinates and checked against native inputs. Omission infers native context or defaults raw coordinates to unreferenced planar. Coordinates are not transformed.

None

Create a MultiPoint geometry from a coordinate sequence.

Returns:

Type Description
MultiPoint

A multipoint geometry — empty when no coordinates are given.

Raises:

Type Description
InvalidGeometryError

If any coordinate is non-finite or has mixed dimensionality.

CRSMismatchError

If native members have conflicting coordinate frames.

GeometryError

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

Examples:

>>> import gometry as gm
>>> gm.MultiPoint([(0, 0), (1, 1)]).to_wkt()
'MULTIPOINT ((0 0), (1 1))'
>>> gm.MultiPoint().to_wkt()
'MULTIPOINT EMPTY'

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__getitem__

Accepted call forms
__getitem__(index: SupportsIndex, /) -> Point
__getitem__(index: slice, /) -> list[Point]
__getitem__(index: SupportsIndex | slice, /) -> Point | list[Point]

Select parts by integer or slice.

An int returns one component geometry. A slice returns a list of component geometries.

Returns:

Type Description
Geometry or list of Geometry

__iter__

__iter__() -> GeometryPartsIterator[Point]

Iterate component geometries.

Returns:

Type Description
iterator of Geometry

__len__

__len__() -> int

Number of component parts.

Returns:

Type Description
int

__reversed__

__reversed__() -> GeometryPartsIterator[Point]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

LineString

Accepted call forms
LineString(
    coordinates: None = None,
    *,
    x: None = None,
    y: None = None,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> LineString
LineString(
    coordinates: Iterable[Iterable[float]] | Coordinates,
    *,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> LineString
LineString(
    coordinates: None = None,
    *,
    x: FloatColumn,
    y: FloatColumn,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> LineString

A single linestring (polyline).

Parameters:

Name Type Description Default
coordinates None | Iterable[Iterable[float]] | Coordinates

The vertices as (x, y[, z, m]) tuples; omitted builds an empty line.

Ordered (x, y[, z[, m]]) tuples, or an (N, 2..4) array. Mutually exclusive with the x/y column form. Omit all inputs for an empty linestring.

varies by call form
x None | FloatColumn

Column form: parallel ordinate arrays, one entry per vertex.

Per-vertex X and Y ordinates as parallel columns, as an alternative to coordinates. Both are required together.

varies by call form
y None | FloatColumn

Column form: parallel ordinate arrays, one entry per vertex.

Per-vertex X and Y ordinates as parallel columns, as an alternative to coordinates. Both are required together.

varies by call form
z None | FloatColumn | None

Column form: parallel ordinate arrays, one entry per vertex.

Per-vertex Z and M ordinates, as an alternative to inline tuples.

None
m None | FloatColumn | None

Column form: parallel ordinate arrays, one entry per vertex.

Per-vertex Z and M ordinates, as an alternative to inline tuples.

None
space Space | None

Interpret the coordinates in this Space. Omission uses unreferenced Planar Space.

Complete interpretation assigned to the coordinate sequence. Omission selects unreferenced planar. Coordinates are not transformed.

None

Create a LineString from an ordered coordinate sequence.

Returns:

Type Description
LineString

A linestring geometry — empty when no coordinates are given.

Raises:

Type Description
InvalidGeometryError

If coordinates are non-finite, ragged, or fewer than two vertices.

Examples:

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

parts property

Lazy view over this geometry's top-level parts.

Simple geometries expose themselves as a one-row view; multipart and collection geometries expose their members. GeometryArray(geom.parts) materializes them as an array.

Returns:

Type Description
GeometryParts

MultiLineString

Accepted call forms
MultiLineString(
    lines: Iterable[LineString | Iterable[Iterable[float]]] | None = None,
    *,
    space: Space | None = None,
) -> MultiLineString

A collection of linestrings.

Parameters:

Name Type Description Default
lines Iterable[LineString | Iterable[Iterable[float]]] | None

The member lines; omitted builds an empty multilinestring.

Each member is an ordered coordinate sequence (a line) or an already-built LineString. Omit for an empty multilinestring.

None
space Space | None

Assign this Space to raw coordinate sequences. Existing lines must share the resulting Space.

Complete interpretation, assigned to raw coordinates and checked against native members. Omission infers native context or defaults raw coordinates to unreferenced planar. Coordinates are not transformed.

None

Create a MultiLineString from a sequence of line coordinate sequences.

Returns:

Type Description
MultiLineString

A multilinestring geometry — empty when lines is omitted.

Raises:

Type Description
InvalidGeometryError

If a member line has fewer than two vertices or non-finite coordinates.

CRSMismatchError

If native members have conflicting coordinate frames.

GeometryError

If native curve models conflict.

Examples:

>>> import gometry as gm
>>> gm.MultiLineString([[(0, 0), (1, 1)], [(2, 2), (3, 3)]]).to_wkt()
'MULTILINESTRING ((0 0, 1 1), (2 2, 3 3))'
>>> gm.MultiLineString().to_wkt()
'MULTILINESTRING EMPTY'

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__getitem__

Accepted call forms
__getitem__(index: SupportsIndex, /) -> LineString
__getitem__(index: slice, /) -> list[LineString]
__getitem__(index: SupportsIndex | slice, /) -> LineString | list[LineString]

Select parts by integer or slice.

An int returns one component geometry. A slice returns a list of component geometries.

Returns:

Type Description
Geometry or list of Geometry

__iter__

__iter__() -> GeometryPartsIterator[LineString]

Iterate component geometries.

Returns:

Type Description
iterator of Geometry

__len__

__len__() -> int

Number of component parts.

Returns:

Type Description
int

__reversed__

__reversed__() -> GeometryPartsIterator[LineString]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

Polygon

Accepted call forms
Polygon(
    shell: None = None,
    holes: None = None,
    *,
    x: None = None,
    y: None = None,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> Polygon
Polygon(
    shell: Iterable[Iterable[float]] | Coordinates,
    holes: Iterable[Iterable[Iterable[float]] | Coordinates] | None = None,
    *,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> Polygon
Polygon(
    shell: None = None,
    holes: Iterable[Iterable[Iterable[float]] | Coordinates] | None = None,
    *,
    x: FloatColumn,
    y: FloatColumn,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> Polygon

A single polygon (an exterior ring with optional holes).

Parameters:

Name Type Description Default
shell None | Iterable[Iterable[float]] | Coordinates

Exterior ring vertices; omitted builds POLYGON EMPTY.

Exterior ring coordinates; closed automatically (needs ≥3 corners). Mutually exclusive with the x/y column form.

varies by call form
holes None | Iterable[Iterable[Iterable[float]] | Coordinates] | None

Interior rings, each a coordinate sequence.

Interior ring (hole) coordinate sequences, each closed automatically.

None
x None | FloatColumn

Column form for the exterior ring: parallel ordinate arrays.

Per-vertex X and Y ordinates for the exterior ring, as an alternative to shell. Both are required together.

varies by call form
y None | FloatColumn

Column form for the exterior ring: parallel ordinate arrays.

Per-vertex X and Y ordinates for the exterior ring, as an alternative to shell. Both are required together.

varies by call form
z None | FloatColumn | None

Column form for the exterior ring: parallel ordinate arrays.

Per-vertex Z and M ordinates for the exterior ring.

None
m None | FloatColumn | None

Column form for the exterior ring: parallel ordinate arrays.

Per-vertex Z and M ordinates for the exterior ring.

None
space Space | None

Interpret the ring coordinates in this Space. Omission uses unreferenced Planar Space.

Complete interpretation assigned to the coordinate rings. Omission selects unreferenced planar. Coordinates are not transformed. In chart or spherical Space, the polygon interior lies to the left of each supplied ring; winding can select a region larger than a hemisphere.

None

Create a Polygon from an exterior ring and optional holes.

Returns:

Type Description
Polygon

A polygon geometry.

Raises:

Type Description
InvalidGeometryError

If a ring has fewer than three corners or any coordinate is non-finite.

Examples:

>>> import gometry as gm
>>> gm.Polygon([(0, 0), (1, 0), (1, 1), (0, 1)]).to_wkt()
'POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))'
>>> gm.Polygon().to_wkt()
'POLYGON EMPTY'

exterior property

exterior: LineString

Exterior ring as a closed LineString. POLYGON EMPTY returns an empty line preserving the polygon's declared axes.

Returns:

Type Description
LineString

The closed exterior ring, or an axis-preserving empty line for POLYGON EMPTY. The result retains the polygon's CRS and epoch.

interiors property

interiors: list[LineString]

Interior rings (holes), each a closed LineString. The list follows the polygon's ring order; POLYGON EMPTY has no interior rings.

Returns:

Type Description
list of LineString

A new list with one closed ring per hole, in polygon ring order. Empty polygons return an empty list. Each ring retains the polygon's declared axes, CRS, and epoch.

parts property

Lazy view over this geometry's top-level parts.

Simple geometries expose themselves as a one-row view; multipart and collection geometries expose their members. GeometryArray(geom.parts) materializes them as an array.

Returns:

Type Description
GeometryParts

full classmethod

full(*, space: Space) -> Self

Create the entire geographic surface without stored coordinate records.

Full is nonempty, has XY axes and has no stored shell or holes. The supplied Space, including its CRS and epoch, is retained.

Parameters:

Name Type Description Default
space Space

Complete chart or spherical interpretation with a geographic CRS.

required

Returns:

Type Description
Polygon

The full surface in the requested Space.

Raises:

Type Description
CRSError

If the Space is planar or its CRS does not resolve to a geographic frame.

MultiPolygon

Accepted call forms
MultiPolygon(
    polygons: Iterable[
        Polygon
        | (Iterable[Iterable[float]] | Coordinates)
        | Iterable[Iterable[Iterable[float]] | Coordinates]
    ]
    | None = None,
    *,
    space: Space | None = None,
) -> MultiPolygon

A collection of polygons.

Parameters:

Name Type Description Default
polygons Iterable[Polygon | (Iterable[Iterable[float]] | Coordinates) | Iterable[Iterable[Iterable[float]] | Coordinates]] | None

The member polygons; omitted builds an empty multipolygon.

Each member is [shell] or [shell, *holes] of coordinate rings, or an already-built Polygon. Omit for an empty multipolygon.

None
space Space | None

Assign this Space to raw rings. Existing polygons must share the resulting Space.

Complete interpretation, assigned to raw coordinates and checked against native members. Omission infers native context or defaults raw coordinates to unreferenced planar. Coordinates are not transformed.

None

Create a MultiPolygon from a sequence of polygons.

Returns:

Type Description
MultiPolygon

A multipolygon geometry — empty when polygons is omitted.

Raises:

Type Description
InvalidGeometryError

If any ring has fewer than three corners or non-finite coordinates.

CRSMismatchError

If native members have conflicting coordinate frames.

GeometryError

If native curve models conflict.

Examples:

>>> import gometry as gm
>>> left = [[(0, 0), (1, 0), (1, 1)]]
>>> right = [[(2, 2), (3, 2), (3, 3)]]
>>> len(gm.MultiPolygon([left, right]).parts)
2
>>> gm.MultiPolygon().to_wkt()
'MULTIPOLYGON EMPTY'

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__getitem__

Accepted call forms
__getitem__(index: SupportsIndex, /) -> Polygon
__getitem__(index: slice, /) -> list[Polygon]
__getitem__(index: SupportsIndex | slice, /) -> Polygon | list[Polygon]

Select parts by integer or slice.

An int returns one component geometry. A slice returns a list of component geometries.

Returns:

Type Description
Geometry or list of Geometry

__iter__

__iter__() -> GeometryPartsIterator[Polygon]

Iterate component geometries.

Returns:

Type Description
iterator of Geometry

__len__

__len__() -> int

Number of component parts.

Returns:

Type Description
int

__reversed__

__reversed__() -> GeometryPartsIterator[Polygon]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

GeometryCollection

Accepted call forms
GeometryCollection(
    geometries: Iterable[Geometry] | None = None, *, space: Space | None = None
) -> GeometryCollection

A heterogeneous collection of geometries.

Parameters:

Name Type Description Default
geometries Iterable[Geometry] | None

The member geometries, of any types; omitted builds an empty collection.

Member geometries; may be of mixed types. Omit for an empty collection.

None
space Space | None

Require this Space for all existing members. When omitted, inherit their common Space, or use unreferenced Planar Space for an empty collection.

Complete interpretation checked against every native member. Omission infers member context, or defaults an anonymous empty collection to unreferenced planar.

None

Create a GeometryCollection from a sequence of geometries.

Returns:

Type Description
GeometryCollection

A geometry collection — empty when geometries is omitted.

Raises:

Type Description
TypeError

If any member is not a Geometry.

CRSMismatchError

If members carry conflicting CRS/epoch metadata.

GeometryError

If native curve models conflict or mixed points lack a common Space.

Examples:

>>> import gometry as gm
>>> gc = gm.GeometryCollection([gm.Point(0, 0), gm.Point(1, 1)])
>>> gc.geometry_type
'GeometryCollection'
>>> gm.GeometryCollection().to_wkt()
'GEOMETRYCOLLECTION EMPTY'

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__getitem__

Accepted call forms
__getitem__(index: SupportsIndex, /) -> Geometry
__getitem__(index: slice, /) -> list[Geometry]
__getitem__(index: SupportsIndex | slice, /) -> Geometry | list[Geometry]

Select parts by integer or slice.

An int returns one component geometry. A slice returns a list of component geometries.

Returns:

Type Description
Geometry or list of Geometry

__iter__

__iter__() -> GeometryPartsIterator[Geometry]

Iterate component geometries.

Returns:

Type Description
iterator of Geometry

__len__

__len__() -> int

Number of component parts.

Returns:

Type Description
int

__reversed__

__reversed__() -> GeometryPartsIterator[Geometry]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

Curves and surfaces

CircularString

Accepted call forms
CircularString(
    coordinates: None = None,
    *,
    x: None = None,
    y: None = None,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> CircularString
CircularString(
    coordinates: Iterable[Iterable[float]] | Coordinates,
    *,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> CircularString
CircularString(
    coordinates: None = None,
    *,
    x: FloatColumn,
    y: FloatColumn,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> CircularString

A string of circular arcs.

Each arc passes through three control points and the next arc starts at its last point, so a circular string stores an odd number of at least three points. When an arc's first and last points coincide, it is the full circle whose diameter joins them to the middle point.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
coordinates None | Iterable[Iterable[float]] | Coordinates

The control points as (x, y[, z, m]) tuples; omitted builds an empty circular string.

Ordered (x, y[, z[, m]]) tuples, or an (N, 2..4) array, with an odd number of at least three points. Mutually exclusive with the x/y column form. Omit all inputs for an empty circular string.

varies by call form
x None | FloatColumn

Column form: parallel ordinate arrays, one entry per control point.

Per-point X and Y ordinates as parallel columns, as an alternative to coordinates. Both are required together.

varies by call form
y None | FloatColumn

Column form: parallel ordinate arrays, one entry per control point.

Per-point X and Y ordinates as parallel columns, as an alternative to coordinates. Both are required together.

varies by call form
z None | FloatColumn | None

Column form: parallel ordinate arrays, one entry per control point.

Per-point Z and M ordinates, as an alternative to inline tuples.

None
m None | FloatColumn | None

Column form: parallel ordinate arrays, one entry per control point.

Per-point Z and M ordinates, as an alternative to inline tuples.

None
space Space | None

Interpret the coordinates in this planar Space. Omission uses unreferenced Planar Space.

Planar interpretation assigned to the coordinates. Omission selects unreferenced planar. Coordinates are not transformed.

None

Create a CircularString from its control points.

Each consecutive (start, mid, end) triple defines the circular arc through those three points, and adjacent arcs share an endpoint. Three collinear points define a straight segment.

Returns:

Type Description
CircularString

The circular string, or an empty one when no coordinates are given.

Raises:

Type Description
InvalidGeometryError

If the point count is not odd and at least 3, or space is not planar.

Examples:

>>> import gometry as gm
>>> arc = gm.CircularString([(0, 0), (1, 1), (2, 0)])
>>> arc.to_wkt()
'CIRCULARSTRING (0 0, 1 1, 2 0)'
>>> round(arc.length, 12)
3.14159265359

CompoundCurve

Accepted call forms
CompoundCurve(
    curves: Iterable[
        LineString | CircularString | (Iterable[Iterable[float]] | Coordinates)
    ]
    | None = None,
    *,
    space: Space | None = None,
) -> CompoundCurve

A continuous curve of line and circular-arc sections.

Each LineString or CircularString section starts where the previous one ends.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
curves Iterable[LineString | CircularString | (Iterable[Iterable[float]] | Coordinates)] | None

The sections in order; a coordinate sequence is a LineString section. Omitted builds an empty compound curve.

Sections in order; each starts where the previous one ends. A coordinate sequence is a straight LineString section. Omit for an empty compound curve.

None
space Space | None

Assign this planar Space to coordinate sequences. Existing members must share the resulting Space; omission infers it from them or uses unreferenced Planar Space.

None

Create a CompoundCurve from contiguous sections.

Returns:

Type Description
CompoundCurve

The compound curve, or an empty one when no sections are given.

Raises:

Type Description
InvalidGeometryError

If a section does not start where the previous one ends, a member is not a line or circular string, or space is not planar.

Examples:

>>> import gometry as gm
>>> arc = gm.CircularString([(0, 0), (1, 1), (2, 0)])
>>> gm.CompoundCurve([arc, [(2, 0), (4, 0)]]).to_wkt()
'COMPOUNDCURVE (CIRCULARSTRING (0 0, 1 1, 2 0), (2 0, 4 0))'

curves property

curves: list[LineString | CircularString]

The sections in order, each a LineString or CircularString.

Returns:

Type Description
list of LineString or CircularString

A new list of the sections; an empty compound curve has none. Each section retains the curve's Space.

CurvePolygon

Accepted call forms
CurvePolygon(
    shell: LineString
    | CircularString
    | CompoundCurve
    | (Iterable[Iterable[float]] | Coordinates)
    | None = None,
    holes: Iterable[
        LineString
        | CircularString
        | CompoundCurve
        | (Iterable[Iterable[float]] | Coordinates)
    ]
    | None = None,
    *,
    space: Space | None = None,
) -> CurvePolygon

A polygon whose rings may contain circular arcs.

Each ring is a closed LineString, CircularString or CompoundCurve.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
shell LineString | CircularString | CompoundCurve | (Iterable[Iterable[float]] | Coordinates) | None

The exterior ring. A coordinate sequence is closed as a Polygon shell is. Omitted builds an empty curve polygon.

Closed exterior ring. Omit or pass an empty ring for an empty curve polygon.

None
holes Iterable[LineString | CircularString | CompoundCurve | (Iterable[Iterable[float]] | Coordinates)] | None

Interior rings in the same forms as shell.

Closed interior rings of the same kinds as shell. An empty shell cannot have holes.

None
space Space | None

Assign this planar Space to coordinate sequences. Existing members must share the resulting Space; omission infers it from them or uses unreferenced Planar Space.

None

Create a CurvePolygon from closed rings.

Returns:

Type Description
CurvePolygon

The curve polygon, or an empty one retaining any empty shell's axes.

Raises:

Type Description
InvalidGeometryError

If a ring is not closed or not a curve, or space is not planar.

Examples:

>>> import gometry as gm
>>> circle = gm.CircularString([(0, 0), (2, 0), (0, 0)])
>>> disc = gm.CurvePolygon(circle)
>>> round(disc.area, 12)
3.14159265359

exterior property

The exterior ring: a closed LineString, CircularString or CompoundCurve.

Returns:

Type Description
(LineString, CircularString or CompoundCurve)

The first ring, or an empty LineString with the polygon's axes for an empty curve polygon. The ring retains the polygon's Space.

interiors property

The interior rings, in ring order.

Returns:

Type Description
list of LineString, CircularString or CompoundCurve

A new list with one closed ring per hole. Each ring retains the polygon's Space.

MultiCurve

Accepted call forms
MultiCurve(
    curves: Iterable[
        LineString
        | CircularString
        | CompoundCurve
        | (Iterable[Iterable[float]] | Coordinates)
    ]
    | None = None,
    *,
    space: Space | None = None,
) -> MultiCurve

A collection of LineString, CircularString and CompoundCurve members.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
curves Iterable[LineString | CircularString | CompoundCurve | (Iterable[Iterable[float]] | Coordinates)] | None

The members; a coordinate sequence is a LineString. Omitted builds an empty multicurve.

Members in order. A coordinate sequence is a straight LineString member. Omit for an empty multicurve.

None
space Space | None

Assign this planar Space to coordinate sequences. Existing members must share the resulting Space; omission infers it from them or uses unreferenced Planar Space.

None

Create a MultiCurve from curves or coordinate sequences.

Returns:

Type Description
MultiCurve

The multicurve, or an empty one when no members are given.

Raises:

Type Description
InvalidGeometryError

If a member is not a curve, or space is not planar.

Examples:

>>> import gometry as gm
>>> arc = gm.CircularString([(0, 0), (1, 1), (2, 0)])
>>> gm.MultiCurve([arc, [(5, 5), (6, 6)]]).to_wkt()
'MULTICURVE (CIRCULARSTRING (0 0, 1 1, 2 0), (5 5, 6 6))'

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__reversed__

__reversed__() -> GeometryPartsIterator[
    LineString | CircularString | CompoundCurve
]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

MultiSurface

Accepted call forms
MultiSurface(
    surfaces: Iterable[
        Polygon | CurvePolygon | (Iterable[Iterable[float]] | Coordinates)
    ]
    | None = None,
    *,
    space: Space | None = None,
) -> MultiSurface

A collection of Polygon and CurvePolygon members.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
surfaces Iterable[Polygon | CurvePolygon | (Iterable[Iterable[float]] | Coordinates)] | None

The members; a coordinate sequence is a Polygon shell. Omitted builds an empty multisurface.

Members in order. A coordinate sequence is the shell of a Polygon member. Omit for an empty multisurface.

None
space Space | None

Assign this planar Space to coordinate sequences. Existing members must share the resulting Space; omission infers it from them or uses unreferenced Planar Space.

None

Create a MultiSurface from surfaces or shell coordinate sequences.

Returns:

Type Description
MultiSurface

The multisurface, or an empty one when no members are given.

Raises:

Type Description
InvalidGeometryError

If a member is not a Polygon or CurvePolygon, or space is not planar.

Examples:

>>> import gometry as gm
>>> disc = gm.CurvePolygon(gm.CircularString([(0, 0), (2, 0), (0, 0)]))
>>> len(gm.MultiSurface([disc, [(5, 5), (6, 5), (6, 6)]]))
2

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__reversed__

__reversed__() -> GeometryPartsIterator[Polygon | CurvePolygon]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

PolyhedralSurface

Accepted call forms
PolyhedralSurface(
    polygons: Iterable[Polygon | (Iterable[Iterable[float]] | Coordinates)]
    | None = None,
    *,
    space: Space | None = None,
) -> PolyhedralSurface

Polygon patches joined at shared edges, such as the faces of a solid.

is_closed reports whether every edge is shared by exactly two patches, and area is the total patch area projected onto the XY plane.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
polygons Iterable[Polygon | (Iterable[Iterable[float]] | Coordinates)] | None

The patches; a coordinate sequence is a Polygon shell. Omitted builds an empty polyhedral surface.

Patches in order. A coordinate sequence is the shell of a Polygon patch. Omit for an empty polyhedral surface.

None
space Space | None

Assign this planar Space to coordinate sequences. Existing members must share the resulting Space; omission infers it from them or uses unreferenced Planar Space.

None

Create a PolyhedralSurface from polygon patches.

Returns:

Type Description
PolyhedralSurface

The polyhedral surface, or an empty one when no patches are given.

Raises:

Type Description
InvalidGeometryError

If a patch is not a Polygon, or space is not planar.

Examples:

>>> import gometry as gm
>>> faces = gm.PolyhedralSurface([[(0, 0), (1, 0), (1, 1)], [(0, 0), (1, 1), (0, 1)]])
>>> faces.area
1.0

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__reversed__

__reversed__() -> GeometryPartsIterator[Polygon]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

TIN

Accepted call forms
TIN(
    triangles: Iterable[Triangle | (Iterable[Iterable[float]] | Coordinates)]
    | None = None,
    *,
    space: Space | None = None,
) -> TIN

A triangulated irregular network: Triangle patches joined at shared edges.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
triangles Iterable[Triangle | (Iterable[Iterable[float]] | Coordinates)] | None

The patches; a coordinate sequence of three points, or four with the first repeated, is a Triangle. Omitted builds an empty TIN.

Patches in order. A coordinate sequence lists one triangle's three vertices; the closing vertex may be repeated. Omit for an empty TIN.

None
space Space | None

Assign this planar Space to coordinate sequences. Existing members must share the resulting Space; omission infers it from them or uses unreferenced Planar Space.

None

Create a TIN (triangulated irregular network) from triangle patches.

Returns:

Type Description
TIN

The TIN, or an empty one when no triangles are given.

Raises:

Type Description
InvalidGeometryError

If a patch is not a triangle, or space is not planar.

Examples:

>>> import gometry as gm
>>> tin = gm.TIN([[(0, 0), (1, 0), (1, 1)], [(0, 0), (1, 1), (0, 1)]])
>>> tin.to_wkt()
'TIN (((0 0, 1 0, 1 1, 0 0)), ((0 0, 1 1, 0 1, 0 0)))'

parts property

The component geometries.

Returns:

Type Description
GeometryParts

A lazy view of immediate components in component order. It retains the source geometry; each component has the type declared by its owning geometry class. Scalar indexing and iteration create one typed geometry at a time, while slices return a list.

__reversed__

__reversed__() -> GeometryPartsIterator[Triangle]

Iterate component geometries in reverse order.

Returns:

Type Description
iterator of Geometry

count

count(value: object) -> int

Number of parts equal to value.

Parameters:

Name Type Description Default
value object

The geometry value to count.

required

Returns:

Type Description
int

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> multi.count(multi[0])
1

index

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

First index of an equal part in [start, stop).

Parameters:

Name Type Description Default
value object

The geometry value to locate.

required
start int

First position searched.

0
stop int

One past the last position searched.

None

Returns:

Type Description
int

The first matching position.

Raises:

Type Description
ValueError

If no part in the window equals value.

Examples:

>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0

Triangle

Accepted call forms
Triangle(
    shell: None = None,
    *,
    x: None = None,
    y: None = None,
    z: None = None,
    m: None = None,
    space: Space | None = None,
) -> Triangle
Triangle(
    shell: Iterable[Iterable[float]] | Coordinates,
    *,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> Triangle
Triangle(
    shell: None = None,
    *,
    x: FloatColumn,
    y: FloatColumn,
    z: FloatColumn | None = None,
    m: FloatColumn | None = None,
    space: Space | None = None,
) -> Triangle

A polygon with exactly three vertices and no holes.

Curves and surfaces need a planar Space and round-trip exactly through WKB, WKT, Arrow, pickle and PostGIS. length, area, bounds and centroid follow the true arcs in coordinate units, and rotation, reflection, translation and uniform scaling keep arcs circular. Other operations raise GeometryTypeError until linearize() converts the value to simple features.

Parameters:

Name Type Description Default
shell None | Iterable[Iterable[float]] | Coordinates

Three vertices, or four with the first repeated at the end. Omitted builds an empty triangle.

The three vertices as (x, y[, z[, m]]) tuples or a (3, 2..4) array; the closing vertex may be repeated. Mutually exclusive with the x/y column form. Omit all inputs for an empty triangle.

varies by call form
x None | FloatColumn

Column form for the vertices: parallel ordinate arrays.

Per-vertex X and Y ordinates as parallel columns, as an alternative to shell. Both are required together.

varies by call form
y None | FloatColumn

Column form for the vertices: parallel ordinate arrays.

Per-vertex X and Y ordinates as parallel columns, as an alternative to shell. Both are required together.

varies by call form
z None | FloatColumn | None

Column form for the vertices: parallel ordinate arrays.

Per-vertex Z and M ordinates, as an alternative to inline tuples.

None
m None | FloatColumn | None

Column form for the vertices: parallel ordinate arrays.

Per-vertex Z and M ordinates, as an alternative to inline tuples.

None
space Space | None

Interpret the coordinates in this planar Space. Omission uses unreferenced Planar Space.

Planar interpretation assigned to the coordinates. Omission selects unreferenced planar. Coordinates are not transformed.

None

Create a Triangle from three vertices.

Returns:

Type Description
Triangle

The triangle, or an empty one when no coordinates are given.

Raises:

Type Description
InvalidGeometryError

If there are not exactly three vertices, or space is not planar.

Examples:

>>> import gometry as gm
>>> gm.Triangle([(0, 0), (4, 0), (0, 3)]).area
6.0

exterior property

exterior: LineString

The closed ring of four points, first and last equal.

Returns:

Type Description
LineString

The ring, or an empty LineString with the triangle's axes for an empty triangle. The ring retains the triangle's Space.