shapely.from_ragged_array#
- from_ragged_array(geometry_type, coords, offsets=None)#
Creates geometries from a contiguous array of coordinates and offset arrays.
This function creates geometries from the ragged array representation as returned by
to_ragged_array
.This follows the in-memory layout of the variable size list arrays defined by Apache Arrow, as specified for geometries by the GeoArrow project: geoarrow/geoarrow.
See
to_ragged_array()
for more details.- Parameters:
- geometry_typeGeometryType
The type of geometry to create.
- coordsnp.ndarray
Contiguous array of shape (n, 2) or (n, 3) of all coordinates for the geometries.
- offsets: tuple of np.ndarray
Offset arrays that allow to reconstruct the geometries based on the flat coordinates array. The number of offset arrays depends on the geometry type. See geoarrow/geoarrow for details.
- Returns:
- np.ndarray
Array of geometries (1-dimensional).
See also