Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
>>> union_all([[line_1, line_2, None]], axis=1).tolist()
[]
"""
# for union_all, GEOS provides an efficient route through first creating
# GeometryCollections
# first roll the aggregation axis backwards
geometries = np.asarray(geometries)
if axis is None:
geometries = geometries.ravel()
else:
geometries = np.rollaxis(
np.asarray(geometries), axis=axis, start=geometries.ndim
)
# create_collection acts on the inner axis
collections = lib.create_collection(geometries, GeometryType.GEOMETRYCOLLECTION)
return lib.unary_union(collections, **kwargs)
def multipoints(geometries):
"""Create multipoints from arrays of points
Parameters
----------
geometries : array_like
An array of points or coordinates (see points).
"""
geometries = np.asarray(geometries)
if not isinstance(geometries, Geometry) and np.issubdtype(
geometries.dtype, np.number
):
geometries = points(geometries)
return lib.create_collection(geometries, GeometryType.MULTIPOINT)