coverage_union#

GeosSeriesAccessor.coverage_union(other=None, manner=None, **kwargs)#

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

Applies shapely.set_operations.coverage_union to (self, other) and returns the result. If no other data is given, the function gets applied to all possible combinations of the self data, by expanding the array.

Parameters:
  • other (pandas.Series or numpy.ndarray or shapely.Geometry, optional) – Second argument to coverage_union; Default self.

  • manner ('keep' or 'align' or 'expand', optional) – How to apply the coverage_union to the data; Default None .

  • kwargs – Keyword arguments passed to coverage_union.

Returns:

Series with the result of the function applied to self and other, with the same index as self. numpy.ndarray: 2-Dimensional array with the results of the function applied to each combination of geometries between self and other.

Return type:

pandas.Series

Raises:

ValueErrorother argument is not a geos Series or shapely NumPy Array

Note

The manner argument dictates how the data gets transformed before applying coverage_union:

  • keep:

    Keep the original data as is and simply run the function. This returns a Series where the index is the same as the self data.

  • align:

    Align both Series according to their index, before running the function (we align the data according the self data). This returns a Series where the index is the same as the self data.

  • expand:

    Expand the data with a new index, before running the function. This means that the result will be an array of dimensions <len(a), len(b)> containing the result of all possible combinations of geometries.

Of course, not every method is applicable for each type of other input. Here are the allowed manners for each type of input, as well as the default value:

  • Series: keep, align, expand (default: align)

  • 1D ndarray: keep, expand (default: keep)

  • nD ndarray: keep (default: keep)

  • Geometry: keep (default: keep)

  • None (aka. use self): expand (default: expand)