Source: https://gometry.monicz.dev/api/constructors/

# Constructors & bulk factories

Construct geometry values and packed coordinate columns.

**Related:** [Geometry types](https://gometry.monicz.dev/api/geometry-types/)

## box

Accepted call forms

```python
box(
    minx: FloatScalar | ScalarFloatArray,
    miny: FloatScalar | ScalarFloatArray,
    maxx: FloatScalar | ScalarFloatArray,
    maxy: FloatScalar | ScalarFloatArray,
    *,
    space: None = None,
    ccw: bool | None = None,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> Polygon
```

```python
box(
    minx: FloatScalar | ScalarFloatArray,
    miny: FloatScalar | ScalarFloatArray,
    maxx: FloatScalar | ScalarFloatArray,
    maxy: FloatScalar | ScalarFloatArray,
    *,
    space: Space,
    ccw: bool | None = None,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> Polygon | MultiPolygon
```

```python
box(
    minx: FloatScalar | ScalarFloatArray,
    miny: FloatScalar | ScalarFloatArray,
    maxx: FloatScalar | ScalarFloatArray,
    maxy: FloatScalar | ScalarFloatArray,
    *,
    space: Space | None,
    ccw: bool | None = None,
    tolerance: FloatScalar | ScalarFloatArray | None = None,
    unit: Literal['meters'] | None = None,
) -> Polygon | MultiPolygon
```

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

Parameters:

| Name | Type | Description | Default |
| --- | --- | --- | --- |
| `minx` | `float` | Finite rectangle bounds. | *required* |
| `miny` | `float` | Finite rectangle bounds. | *required* |
| `maxx` | `float` | Finite rectangle bounds. | *required* |
| `maxy` | `float` | Finite rectangle bounds. | *required* |
| `space` | `Space` | Complete interpretation assigned to the rectangle. Coordinates are not transformed. A geographic CRS alone does not enable wrapping. Chart and Spherical bounds may use `minx > maxx` for a seam-crossing interval. | *required* |
| `tolerance` | `float` | Positional tolerance in meters for Spherical refinement. Omission selects a scale-aware default; zero requests the highest practical fidelity under the construction budget. | `None` |
| `unit` | `'meters'` | `tolerance` is a physical distance in meters. | `'meters'` |
| `ccw` | `bool or None` | Select ring winding for Planar bounds. `None` uses the ordinary orientation; explicit values are not accepted for geographic models. | `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. |
| `GeometryError` | If Planar bounds are unordered, geographic bounds lie outside their frame, or `ccw` is supplied for Chart/Spherical Space. |

Examples:

```pycon
>>> 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, space=gm.Space(crs=4326, model='chart')).bounds
(170.0, -10.0, -170.0, 10.0)
```

## boxes

Accepted call forms

```python
boxes(
    minx: FloatInput,
    miny: FloatInput,
    maxx: FloatInput,
    maxy: FloatInput,
    *,
    space: None = None,
    ccw: bool | None = None,
    tolerance: FloatInput | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon]
```

```python
boxes(
    minx: FloatInput,
    miny: FloatInput,
    maxx: FloatInput,
    maxy: FloatInput,
    *,
    space: Space,
    ccw: bool | None = None,
    tolerance: FloatInput | None = None,
    unit: Literal['meters'] | None = None,
) -> GeometryArray[Polygon | MultiPolygon]
```

```python
boxes(
    minx: FloatInput,
    miny: FloatInput,
    maxx: FloatInput,
    maxy: FloatInput,
    *,
    space: Space | None,
    ccw: bool | None = None,
    tolerance: FloatInput | None = None,
    unit: Literal['meters'] | 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* |
| `space` | `Space` | Complete interpretation assigned to every box. A geographic CRS alone does not enable wrapping. Chart and Spherical bounds may use `minx > maxx` for a seam-crossing interval. | *required* |
| `tolerance` | `float or sequence of float` | Positional tolerance in meters for Spherical refinement. Omission selects a per-row scale-aware default; zero requests the highest practical fidelity under each row's budget. | `None` |
| `unit` | `'meters'` | `tolerance` is a physical distance in meters. | `'meters'` |
| `ccw` | `bool or None` | Select ring winding for Planar bounds. `None` uses the ordinary orientation; explicit values are not accepted for geographic models. | `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. |
| `GeometryError` | If Planar bounds are unordered, geographic bounds lie outside their frame, or `ccw` is supplied for Chart/Spherical Space. |

Examples:

```pycon
>>> 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], space=gm.Space(crs=4326, model='chart'))[0].bounds
(170.0, -10.0, -170.0, 10.0)
```

## points

Accepted call forms

```python
points(
    x: Iterable[Iterable[float]] | Coordinates | Iterable[Point],
    y: None = None,
    *,
    z: FloatInput | None = None,
    m: FloatInput | None = None,
    space: Space | None = None,
) -> GeometryArray[Point]
```

```python
points(
    x: FloatInput,
    y: FloatInput,
    *,
    z: FloatInput | None = None,
    m: FloatInput | None = None,
    space: Space | 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` |
| `space` | `Space` | Complete interpretation assigned to raw coordinates and checked against native points. Omission infers native context or defaults raw coordinates to unreferenced planar. Mixed chart/spherical native points require an explicit common Space. Coordinates are not transformed. | `None` |

Returns:

| Type | Description |
| --- | --- |
| `GeometryArray` | One Point per coordinate. |

Raises:

| Type | Description |
| --- | --- |
| `InvalidGeometryError` | If columns differ in length or are non-finite. |
| `CRSError` | If a native input CRS cannot be resolved. |
| `CRSMismatchError` | If native points have incompatible coordinate reference systems or epochs. |
| `GeometryError` | If native point models require an explicit common Space. |

See Also

[Point](https://gometry.monicz.dev/api/geometry-types/#gometry.Point "Point") : Build a single point.

Examples:

```pycon
>>> 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

```python
line_strings(
    values: Iterable[LineString | (Iterable[Iterable[float]] | Coordinates)],
    *,
    space: Space | 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* |
| `space` | `Space` | Complete interpretation assigned to raw rows and checked against native rows. Omission infers native context or defaults raw coordinates to unreferenced planar. Native curves must already use the selected model. Coordinates are not transformed. | `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 a native input CRS cannot be resolved. |
| `CRSMismatchError` | If native rows have incompatible coordinate reference systems or epochs. |
| `GeometryError` | If native models cannot be combined in the selected Space. |

Examples:

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

## polygons

```python
polygons(
    values: Iterable[
        Polygon
        | (Iterable[Iterable[float]] | Coordinates)
        | Iterable[Iterable[Iterable[float]] | Coordinates]
    ],
    *,
    space: Space | 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* |
| `space` | `Space` | Complete interpretation assigned to raw rows and checked against native rows. Omission infers native context or defaults raw coordinates to unreferenced planar. Native curves must already use the selected model. Coordinates are not transformed. | `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 a native input CRS cannot be resolved. |
| `CRSMismatchError` | If native rows have incompatible coordinate reference systems or epochs. |
| `GeometryError` | If native models cannot be combined in the selected Space. |

Examples:

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

## multi\_points

```python
multi_points(
    values: Iterable[
        MultiPoint
        | Iterable[Point | Iterable[float]]
        | (Iterable[Iterable[float]] | Coordinates)
    ],
    *,
    space: Space | 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* |
| `space` | `Space` | Complete interpretation assigned to raw coordinates and checked against native members. Omission infers native context or defaults raw coordinates to unreferenced planar. Mixed chart/spherical native points require an explicit common Space. Coordinates are not transformed. | `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 a native input CRS cannot be resolved. |
| `CRSMismatchError` | If geometry rows or multipart members do not share a CRS or epoch. |
| `GeometryError` | If native models cannot be combined in the selected Space. |

Examples:

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

## multi\_line\_strings

```python
multi_line_strings(
    values: Iterable[
        MultiLineString
        | Iterable[LineString | (Iterable[Iterable[float]] | Coordinates)]
    ],
    *,
    space: Space | 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* |
| `space` | `Space` | Complete interpretation assigned to raw coordinates and checked against native members. Omission infers native context or defaults raw coordinates to unreferenced planar. Native curves must already use the selected model. Coordinates are not transformed. | `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 a native input CRS cannot be resolved. |
| `CRSMismatchError` | If geometry rows or multipart members do not share a CRS or epoch. |
| `GeometryError` | If native models cannot be combined in the selected Space. |

Examples:

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

## multi\_polygons

```python
multi_polygons(
    values: Iterable[
        MultiPolygon
        | Iterable[
            Polygon
            | (Iterable[Iterable[float]] | Coordinates)
            | Iterable[Iterable[Iterable[float]] | Coordinates]
        ]
    ],
    *,
    space: Space | 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* |
| `space` | `Space` | Complete interpretation assigned to raw coordinates and checked against native members. Omission infers native context or defaults raw coordinates to unreferenced planar. Native curves must already use the selected model. Coordinates are not transformed. | `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 a native input CRS cannot be resolved. |
| `CRSMismatchError` | If geometry rows or multipart members do not share a CRS or epoch. |
| `GeometryError` | If native models cannot be combined in the selected Space. |

Examples:

```pycon
>>> 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)))']
```
