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 |
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
|
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 |
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 ( |
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['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
|
required |
path
|
('geodesic', 'rhumb')
|
Route model. Geodesic forms omit |
'geodesic'
|
unit
|
'meters'
|
|
'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 |
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 |
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
|
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
¶
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,
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 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
|
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
¶
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,
*,
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 |
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 |
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
¶
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,
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 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
|
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
|
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
|
|
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 |
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 |
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
¶
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
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 |
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
¶
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
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 Ordered |
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
|
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
|
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 |
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 Sections in order; each starts where the previous one ends. A coordinate
sequence is a straight |
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 |
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 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 Closed interior rings of the same kinds as |
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 |
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
¶
exterior: LineString | CircularString | CompoundCurve
The exterior ring: a closed LineString, CircularString or
CompoundCurve.
Returns:
| Type | Description |
|---|---|
(LineString, CircularString or CompoundCurve)
|
The first ring, or an empty |
interiors
property
¶
interiors: list[LineString | CircularString | CompoundCurve]
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 Members in order. A coordinate sequence is a straight |
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 |
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
¶
parts: GeometryParts[LineString | CircularString | CompoundCurve]
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 |
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 Members in order. A coordinate sequence is the shell of a |
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 |
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
¶
parts: GeometryParts[Polygon | CurvePolygon]
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 |
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 Patches in order. A coordinate sequence is the shell of a |
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 |
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
¶
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. |
__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
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 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 |
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
¶
parts: GeometryParts[Triangle]
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 |
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 |
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
|
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
|
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 |
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 |