shapely.points

Contents

shapely.points#

points(coords, y=None, z=None, indices=None, out=None, **kwargs)#

Create an array of points.

Parameters:
coordsarray_like

An array of coordinate tuples (2- or 3-dimensional) or, if y is provided, an array of x coordinates.

yarray_like, optional
zarray_like, optional
indicesarray_like, optional

Indices into the target array where input coordinates belong. If provided, the coords should be 2D with shape (N, 2) or (N, 3) and indices should be an array of shape (N,) with integers in increasing order. Missing indices result in a ValueError unless out is provided, in which case the original value in out is kept.

outndarray, optional

An array (with dtype object) to output the geometries into.

**kwargs

See NumPy ufunc docs for other keyword arguments. Ignored if indices is provided.

Notes

  • GEOS 3.10, 3.11 and 3.12 automatically converts POINT (nan nan) to POINT EMPTY.

  • GEOS 3.10 and 3.11 will transform a 3D point to 2D if its Z coordinate is NaN.

  • Usage of the y and z arguments will prevents lazy evaluation in dask. Instead provide the coordinates as an array with shape (..., 2) or (..., 3) using only the coords argument.

Examples

>>> points([[0, 1], [4, 5]]).tolist()
[<POINT (0 1)>, <POINT (4 5)>]
>>> points([0, 1, 2])
<POINT Z (0 1 2)>