Skip to content

Constructors & bulk factories

Construct geometry values and packed coordinate columns.

Related: Geometry types

box

Accepted call forms
box(minx: FloatScalar | ScalarFloatArray, miny: FloatScalar | ScalarFloatArray, maxx: FloatScalar | ScalarFloatArray, maxy: FloatScalar | ScalarFloatArray, *, crs: None = None, ccw: bool = True, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> Polygon
box(minx: FloatScalar | ScalarFloatArray, miny: FloatScalar | ScalarFloatArray, maxx: FloatScalar | ScalarFloatArray, maxy: FloatScalar | ScalarFloatArray, *, crs: CrsInput, ccw: bool = True, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> Polygon | MultiPolygon
box(minx: FloatScalar | ScalarFloatArray, miny: FloatScalar | ScalarFloatArray, maxx: FloatScalar | ScalarFloatArray, maxy: FloatScalar | ScalarFloatArray, *, crs: CrsInput | None, ccw: bool = True, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> Polygon | MultiPolygon

Create a rectangular polygon from bounds (minx, miny, maxx, maxy).

Parameters:

Name Type Description Default
minx float

Finite rectangle bounds. With a geographic CRS, minx > maxx selects the interval crossing the frame's longitude seam.

required
miny float

Finite rectangle bounds. With a geographic CRS, minx > maxx selects the interval crossing the frame's longitude seam.

required
maxx float

Finite rectangle bounds. With a geographic CRS, minx > maxx selects the interval crossing the frame's longitude seam.

required
maxy float

Finite rectangle bounds. With a geographic CRS, minx > maxx selects the interval crossing the frame's longitude seam.

required
crs CRS - like

CRS label (EPSG code, authority string, or WKT); attached as metadata, coordinates are not transformed. With a geographic CRS, bounds within the frame's native longitude and latitude ranges use chart edges along parallels and meridians. A seam-crossing interval returns a MultiPolygon; (-half_period, half_period) selects the full longitude band. Ordered bounds outside those ranges retain the corner-only, unwrapped construction.

required
ccw bool

If True the ring is counter-clockwise; False makes it clockwise.

True
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
Polygon | MultiPolygon

A rectangular polygon, or a MultiPolygon for a seam-crossing interval.

Raises:

Type Description
InvalidGeometryError

If a bound is non-finite or south exceeds north.

CRSError

If epoch is set without crs.

GeometryError

If epoch is invalid, bounds are unordered outside a valid geographic seam crossing, or seam-crossing bounds lie outside their CRS frame.

Examples:

>>> import gometry as gm
>>> gm.box(0, 0, 2, 1).to_wkt()
'POLYGON ((0 0, 2 0, 2 1, 0 1, 0 0))'
>>> gm.box(0, 0, 2, 1, ccw=False).to_wkt()
'POLYGON ((0 0, 0 1, 2 1, 2 0, 0 0))'
>>> gm.box(170, -10, -170, 10, crs=4326).bounds
(170.0, -10.0, -170.0, 10.0)

boxes

Accepted call forms
boxes(minx: FloatInput, miny: FloatInput, maxx: FloatInput, maxy: FloatInput, *, crs: None = None, ccw: bool = True, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[Polygon]
boxes(minx: FloatInput, miny: FloatInput, maxx: FloatInput, maxy: FloatInput, *, crs: CrsInput, ccw: bool = True, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[Polygon | MultiPolygon]
boxes(minx: FloatInput, miny: FloatInput, maxx: FloatInput, maxy: FloatInput, *, crs: CrsInput | None, ccw: bool = True, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[Polygon | MultiPolygon]

Create a GeometryArray of rectangular polygons from bound columns.

Parameters:

Name Type Description Default
minx float or sequence of float

Rectangle bounds per row. Scalars broadcast numpy-style; four scalar bounds produce a one-row array.

required
miny float or sequence of float

Rectangle bounds per row. Scalars broadcast numpy-style; four scalar bounds produce a one-row array.

required
maxx float or sequence of float

Rectangle bounds per row. Scalars broadcast numpy-style; four scalar bounds produce a one-row array.

required
maxy float or sequence of float

Rectangle bounds per row. Scalars broadcast numpy-style; four scalar bounds produce a one-row array.

required
crs CRS - like

CRS applied to every box. Geographic rows follow the same native-range chart-edge and corner-only unwrapped rules as box; west > east selects a seam-crossing interval.

required
ccw bool

If True each ring is counter-clockwise; False makes it clockwise.

True
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One Polygon or MultiPolygon per bound tuple.

Raises:

Type Description
InvalidGeometryError

If a bound is non-finite or south exceeds north in any row.

CRSError

If epoch is set without crs.

GeometryError

If epoch is invalid, bounds are unordered outside a valid geographic seam crossing, or seam-crossing bounds lie outside their CRS frame.

Examples:

>>> import gometry as gm
>>> gm.boxes(0, 0, [1, 2], [1, 2]).to_wkt()
['POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))', 'POLYGON ((0 0, 2 0, 2 2, 0 2, 0 0))']
>>> gm.boxes([170], [-10], [-170], [10], crs=4326)[0].bounds
(170.0, -10.0, -170.0, 10.0)

points

Accepted call forms
points(x: Iterable[Iterable[float]] | Coordinates | Iterable[Point], y: None = None, *, z: FloatInput | None = None, m: FloatInput | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[Point]
points(x: FloatInput, y: FloatInput, *, z: FloatInput | None = None, m: FloatInput | None = None, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[Point]

Create a GeometryArray of points from parallel coordinate columns.

Pass either coordinate rows or separate x/y columns. Separate columns keep axis order explicit and accept scalars that broadcast across rows; when both are scalars, the result contains one point.

Parameters:

Name Type Description Default
x coordinate rows or float or sequence of float

Coordinate rows as (x, y[, z[, m]]) values, or the X column.

required
y float or sequence of float

Y column when x is an X column. Omit it when x contains rows.

required
z float or sequence of float

Z and M ordinates, broadcast like x/y.

None
m float or sequence of float

Z and M ordinates, broadcast like x/y.

None
crs CRS - like

CRS label (EPSG code, authority string, or WKT); attached as metadata, coordinates are not transformed.

None
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One Point per coordinate.

Raises:

Type Description
InvalidGeometryError

If columns differ in length or are non-finite.

CRSError

If epoch is set without crs, or crs is not recognized.

GeometryError

If epoch is invalid.

See Also

Point : Build a single point.

Examples:

>>> import gometry as gm
>>> gm.points([0, 1], [0, 1]).to_wkt()
['POINT (0 0)', 'POINT (1 1)']
>>> gm.points(1, 2).to_wkt()
['POINT (1 2)']
>>> gm.points([(1, 2), (3, 4)]).to_wkt()
['POINT (1 2)', 'POINT (3 4)']

line_strings

line_strings(values: Iterable[LineString | (Iterable[Iterable[float]] | Coordinates)], *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[LineString]

Create a GeometryArray of linestrings from coordinate rows or Linestrings.

Parameters:

Name Type Description Default
values sequence

Each member is a LineString or a raw coordinate sequence accepted by LineString.

required
crs CRS - like

CRS applied to every linestring.

None
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One LineString per input sequence.

Raises:

Type Description
InvalidGeometryError

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

TypeError

If a geometry row is not a LineString.

CRSError

If epoch is set without crs, or crs is not recognized.

CRSMismatchError

If geometry rows do not share a CRS or coordinate epoch.

GeometryError

If epoch is not a finite decimal year.

Examples:

>>> import gometry as gm
>>> lines = gm.line_strings([[(0, 0), (1, 1)], [(2, 2), (3, 3)]])
>>> len(lines)
2

polygons

polygons(values: Iterable[Polygon | (Iterable[Iterable[float]] | Coordinates) | Iterable[Iterable[Iterable[float]] | Coordinates]], *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[Polygon]

Create a GeometryArray of polygons from raw coordinates or Polygons.

Parameters:

Name Type Description Default
values sequence

Each member is a Polygon, a raw shell coordinate sequence, or [shell, *holes].

required
crs CRS - like

CRS applied to every polygon.

None
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One Polygon per input.

Raises:

Type Description
InvalidGeometryError

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

TypeError

If a geometry row is not a Polygon.

CRSError

If epoch is set without crs, or crs is not recognized.

CRSMismatchError

If geometry rows do not share a CRS or coordinate epoch.

GeometryError

If epoch is not a finite decimal year.

Examples:

>>> import gometry as gm
>>> polys = gm.polygons([[(0, 0), (1, 0), (1, 1), (0, 1)]])
>>> len(polys)
1

multi_points

multi_points(values: Iterable[MultiPoint | Iterable[Point | Iterable[float]] | (Iterable[Iterable[float]] | Coordinates)], *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[MultiPoint]

Create a GeometryArray of multipoints from per-row inputs.

Parameters:

Name Type Description Default
values sequence

Each member is a MultiPoint or input accepted by MultiPoint, including Point members and raw coordinate values.

required
crs CRS - like

CRS applied to every multipoint.

None
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One MultiPoint per input.

Raises:

Type Description
InvalidGeometryError

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

TypeError

If a geometry row is not a MultiPoint, or a member is not a Point.

CRSError

If epoch is set without crs, or crs is not recognized.

CRSMismatchError

If geometry rows or multipart members do not share a CRS or epoch.

GeometryError

If epoch is not a finite decimal year.

Examples:

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

multi_line_strings

multi_line_strings(values: Iterable[MultiLineString | Iterable[LineString | (Iterable[Iterable[float]] | Coordinates)]], *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[MultiLineString]

Create a GeometryArray of multilinestrings from per-row inputs.

Parameters:

Name Type Description Default
values sequence

Each member is a MultiLineString or input accepted by MultiLineString, including LineString members.

required
crs CRS - like

CRS applied to every multilinestring.

None
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One MultiLineString per input.

Raises:

Type Description
InvalidGeometryError

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

TypeError

If a geometry row is not a MultiLineString, or a member is not a LineString.

CRSError

If epoch is set without crs, or crs is not recognized.

CRSMismatchError

If geometry rows or multipart members do not share a CRS or epoch.

GeometryError

If epoch is not a finite decimal year.

Examples:

>>> import gometry as gm
>>> gm.multi_line_strings([[[(0, 0), (1, 1)]]]).to_wkt()
['MULTILINESTRING ((0 0, 1 1))']

multi_polygons

multi_polygons(values: Iterable[MultiPolygon | Iterable[Polygon | (Iterable[Iterable[float]] | Coordinates) | Iterable[Iterable[Iterable[float]] | Coordinates]]], *, crs: CrsInput | None = None, epoch: SupportsFloat | SupportsIndex | FloatScalar | ScalarFloatArray | None = None) -> GeometryArray[MultiPolygon]

Create a GeometryArray of multipolygons from per-row inputs.

Parameters:

Name Type Description Default
values sequence

Each member is a MultiPolygon or input accepted by MultiPolygon, including Polygon members and shell/ring coordinate shorthand.

required
crs CRS - like

CRS applied to every multipolygon.

None
epoch numeric scalar or 0-D numeric array

Coordinate epoch (decimal year) for time-dependent frames.

None

Returns:

Type Description
GeometryArray

One MultiPolygon per input.

Raises:

Type Description
InvalidGeometryError

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

TypeError

If a geometry row is not a MultiPolygon, or a member is not a Polygon.

CRSError

If epoch is set without crs, or crs is not recognized.

CRSMismatchError

If geometry rows or multipart members do not share a CRS or epoch.

GeometryError

If epoch is not a finite decimal year.

Examples:

>>> import gometry as gm
>>> gm.multi_polygons([[[[(0, 0), (1, 0), (1, 1), (0, 1), (0, 0)]]]]).to_wkt()
['MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)))']