Geometry types¶
The seven typed geometry classes and the members unique to each type. Shared operations live on Geometry.
Related: Geometry
Point
¶
Accepted call forms
Point(x: None = None, y: None = None, *, z: None = None, m: None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> Point
Point(x: Point | Iterable[float], y: None = None, *, z: FloatScalar | ScalarFloatArray | None = None, m: FloatScalar | ScalarFloatArray | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> Point
Point(x: FloatScalar | ScalarFloatArray, y: FloatScalar | ScalarFloatArray, *, z: FloatScalar | ScalarFloatArray | None = None, m: FloatScalar | ScalarFloatArray | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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 |
varies by call form
|
z
|
None | FloatScalar | ScalarFloatArray | None
|
Z ordinate (adds a 3D dimension). Z (elevation) ordinate, producing an |
None
|
m
|
None | FloatScalar | ScalarFloatArray | None
|
M (measure) ordinate. M (measure) ordinate, producing an |
None
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
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 |
Raises:
| Type | Description |
|---|---|
InvalidGeometryError
|
If any coordinate is not finite. |
CRSError
|
If |
GeometryError
|
If |
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, 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 ( |
parts
property
¶
parts: GeometryParts[Point]
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 ( |
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 ( |
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 ( |
destination
¶
Accepted call forms
destination(bearing: ScalarFloatArray, distance: FloatScalar | ScalarFloatArray, *, path: Literal['geodesic'] = 'geodesic', unit: Literal['planar', 'meters'] | None = None) -> Point
destination(bearing: FloatScalar | ScalarFloatArray, distance: ScalarFloatArray, *, path: Literal['geodesic'] = 'geodesic', unit: Literal['planar', 'meters'] | None = None) -> Point
destination(bearing: FloatScalar | ScalarFloatArray, distance: FloatScalar | ScalarFloatArray, *, path: Literal['geodesic'] = 'geodesic', unit: Literal['planar', 'meters'] | 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['planar', 'meters'] | 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['planar', 'meters'] | 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['planar', 'meters'] | None = None) -> GeometryArray[Point]
destination(bearing: FloatInput, distance: FloatInput, *, path: Literal['geodesic'] = 'geodesic', unit: Literal['planar', 'meters'] | None = None) -> Point | GeometryArray[Point]
destination(bearing: ScalarFloatArray, distance: FloatScalar | ScalarFloatArray, *, path: Literal['rhumb'], unit: None = None) -> Point
destination(bearing: FloatScalar | ScalarFloatArray, distance: ScalarFloatArray, *, path: Literal['rhumb'], unit: None = None) -> Point
destination(bearing: FloatScalar | ScalarFloatArray, distance: FloatScalar | ScalarFloatArray, *, path: Literal['rhumb'], unit: None = None) -> Point
destination(bearing: FloatColumn | ndarray[tuple[int], dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]]], distance: FloatScalar | ScalarFloatArray, *, path: Literal['rhumb'], unit: None = None) -> GeometryArray[Point]
destination(bearing: FloatScalar | ScalarFloatArray, distance: FloatColumn | ndarray[tuple[int], dtype[floating[Any] | signedinteger[Any] | unsignedinteger[Any]]], *, path: Literal['rhumb'], unit: 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: None = None) -> GeometryArray[Point]
destination(bearing: FloatInput, distance: FloatInput, *, path: Literal['rhumb'], unit: 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
|
required |
path
|
('geodesic', 'rhumb')
|
Route model. Geodesic forms omit |
'geodesic'
|
unit
|
('planar', 'meters')
|
|
'planar'
|
Returns:
| Type | Description |
|---|---|
Point or GeometryArray[Point]
|
The destination point, or one destination per bearing or distance. |
Raises:
| Type | Description |
|---|---|
GeometryError
|
If |
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, crs=4326)
>>> point.destination(90, 1000).to_wkt(precision=5)
'POINT (0.00898 0)'
MultiPoint
¶
Accepted call forms
MultiPoint(coordinates: None = None, *, x: None = None, y: None = None, z: None = None, m: None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> MultiPoint
MultiPoint(coordinates: Iterable[Point | Iterable[float]], *, z: None = None, m: None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> MultiPoint
MultiPoint(coordinates: Iterable[Iterable[float]] | Coordinates, *, z: FloatColumn | None = None, m: FloatColumn | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> MultiPoint
MultiPoint(coordinates: None = None, *, x: FloatColumn, y: FloatColumn, z: FloatColumn | None = None, m: FloatColumn | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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 |
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
|
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
|
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
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
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. |
CRSError
|
If |
GeometryError
|
If |
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
¶
parts: GeometryParts[Point]
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
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
|
|
__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 |
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, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> LineString
LineString(coordinates: Iterable[Iterable[float]] | Coordinates, *, z: FloatColumn | None = None, m: FloatColumn | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> LineString
LineString(coordinates: None = None, *, x: FloatColumn, y: FloatColumn, z: FloatColumn | None = None, m: FloatColumn | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> LineString
A single linestring (polyline).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
coordinates
|
None | Iterable[Iterable[float]] | Coordinates
|
The vertices as Ordered |
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
|
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
|
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
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
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. |
CRSError
|
If |
GeometryError
|
If |
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
¶
parts: GeometryParts[LineString]
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, *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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 |
None
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
None
|
Create a MultiLineString from a sequence of line coordinate sequences.
Returns:
| Type | Description |
|---|---|
MultiLineString
|
A multilinestring geometry — empty when |
Raises:
| Type | Description |
|---|---|
InvalidGeometryError
|
If a member line has fewer than two vertices or non-finite coordinates. |
CRSError
|
If |
GeometryError
|
If |
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
¶
parts: GeometryParts[LineString]
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
|
|
__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 |
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, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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 Exterior ring coordinates; closed automatically (needs ≥3 corners).
Mutually exclusive with the |
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 |
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 |
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
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
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. |
CRSError
|
If |
GeometryError
|
If |
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
|
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
¶
parts: GeometryParts[Polygon]
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
|
|
MultiPolygon
¶
Accepted call forms
MultiPolygon(polygons: Iterable[Polygon | (Iterable[Iterable[float]] | Coordinates) | Iterable[Iterable[Iterable[float]] | Coordinates]] | None = None, *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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 |
None
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
None
|
Create a MultiPolygon from a sequence of polygons.
Returns:
| Type | Description |
|---|---|
MultiPolygon
|
A multipolygon geometry — empty when |
Raises:
| Type | Description |
|---|---|
InvalidGeometryError
|
If any ring has fewer than three corners or non-finite coordinates. |
CRSError
|
If |
GeometryError
|
If |
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
¶
parts: GeometryParts[Polygon]
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
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
|
|
__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 |
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, *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | 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
|
crs
|
CrsInput | None
|
Coordinate reference system, attached as metadata (never transforms coordinates). Any supported CRS input. Declares the frame; does not transform coordinates. |
None
|
epoch
|
SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None
|
Coordinate epoch metadata; the CRS frame must admit geometry epochs. Coordinate epoch (decimal year) for time-dependent frames. |
None
|
Create a GeometryCollection from a sequence of geometries.
Returns:
| Type | Description |
|---|---|
GeometryCollection
|
A geometry collection — empty when |
Raises:
| Type | Description |
|---|---|
TypeError
|
If any member is not a Geometry. |
CRSError
|
If |
CRSMismatchError
|
If members carry conflicting CRS/epoch metadata. |
GeometryError
|
If |
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
¶
parts: GeometryParts[Geometry]
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
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
|
|
__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 |
Examples:
>>> import gometry as gm
>>> multi = gm.MultiPoint([(0, 0), (1, 1)])
>>> part = multi[0]
>>> multi.index(part)
0