Create an array of points. Parameters ---------- coords : array_like An array of coordinate tuples (2- or 3-dimensional) or, if ``y`` is provided, an array of x coordinates. y : array_like, optional An array of y coordinates. z : array_like, optional
(
coords,
y=None,
z=None,
indices=None,
*,
handle_nan=HandleNaN.allow,
out=None,
**kwargs,
)
| 52 | @deprecate_positional(["indices"], category=DeprecationWarning) |
| 53 | @multithreading_enabled |
| 54 | def points( |
| 55 | coords, |
| 56 | y=None, |
| 57 | z=None, |
| 58 | indices=None, |
| 59 | *, |
| 60 | handle_nan=HandleNaN.allow, |
| 61 | out=None, |
| 62 | **kwargs, |
| 63 | ): |
| 64 | """Create an array of points. |
| 65 | |
| 66 | Parameters |
| 67 | ---------- |
| 68 | coords : array_like |
| 69 | An array of coordinate tuples (2- or 3-dimensional) or, if ``y`` is |
| 70 | provided, an array of x coordinates. |
| 71 | y : array_like, optional |
| 72 | An array of y coordinates. |
| 73 | z : array_like, optional |
| 74 | An array of z coordinates. |
| 75 | indices : array_like, optional |
| 76 | Indices into the target array where input coordinates belong. If |
| 77 | provided, the coords should be 2D with shape (N, 2) or (N, 3) and |
| 78 | indices should be an array of shape (N,) with integers in increasing |
| 79 | order. Missing indices result in a ValueError unless ``out`` is |
| 80 | provided, in which case the original value in ``out`` is kept. |
| 81 | handle_nan : shapely.HandleNaN or {'allow', 'skip', 'error'}, default 'allow' |
| 82 | Specifies what to do when a NaN or Inf is encountered in the coordinates: |
| 83 | |
| 84 | - 'allow': the geometries are created with NaN or Inf coordinates. |
| 85 | Note that this can result in unexpected behaviour in subsequent |
| 86 | operations, and generally it is discouraged to have non-finite |
| 87 | coordinate values. One can use this option if you know all |
| 88 | coordinates are finite and want to avoid the overhead of checking |
| 89 | for this. |
| 90 | - 'skip': if any of x, y or z values are NaN or Inf, an empty point |
| 91 | will be created. |
| 92 | - 'error': if any NaN or Inf is detected in the coordinates, a ValueError |
| 93 | is raised. This option ensures that the created geometries have all |
| 94 | finite coordinate values. |
| 95 | |
| 96 | .. versionadded:: 2.1.0 |
| 97 | out : ndarray, optional |
| 98 | An array (with dtype object) to output the geometries into. |
| 99 | **kwargs |
| 100 | See :ref:`NumPy ufunc docs <ufuncs.kwargs>` for other keyword arguments. |
| 101 | Ignored if ``indices`` is provided. |
| 102 | |
| 103 | Examples |
| 104 | -------- |
| 105 | >>> import shapely |
| 106 | >>> shapely.points([[0, 1], [4, 5]]).tolist() |
| 107 | [<POINT (0 1)>, <POINT (4 5)>] |
| 108 | >>> shapely.points([0, 1, 2]) |
| 109 | <POINT Z (0 1 2)> |
| 110 | |
| 111 | Notes |
no test coverage detected
searching dependent graphs…