shapely.coverage_union

Contents

shapely.coverage_union#

coverage_union(a, b, **kwargs)#

Merges multiple polygons into one. This is an optimized version of union which assumes the polygons to be non-overlapping.

Note

‘coverage_union’ requires at least GEOS 3.8.0.

Parameters:
aGeometry or array_like
bGeometry or array_like
**kwargs

See NumPy ufunc docs for other keyword arguments.

Examples

>>> from shapely import normalize, Polygon
>>> polygon = Polygon([(0, 0), (0, 1), (1, 1), (1, 0), (0, 0)])
>>> normalize(coverage_union(polygon, Polygon([(1, 0), (1, 1), (2, 1), (2, 0), (1, 0)])))
<POLYGON ((0 0, 0 1, 1 1, 2 1, 2 0, 1 0, 0 0))>

Union with None returns same polygon >>> normalize(coverage_union(polygon, None)) <POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))>