Make a union of polygons in GeoPandas, or Shapely (into a single geometry)
From the question/answer here, it seems this is called a cascaded_union
within shapely
:
from shapely.ops import cascaded_unionpolygons = [poly1[0], poly1[1], poly2[0], poly2[1]]boundary = gpd.GeoSeries(cascaded_union(polygons))boundary.plot(color = 'red')plt.show()
Note: cascaded_union
is superceded by unary_union
if GEOS 3.2+ is used - this allows unions on different geometry types, not only polygons. To check your version,
>>> shapely.geos.geos_version(3, 5, 1)
If you prefer Geopandas over Shapely you might consider dissolve and use a column with a constant value for all entries:http://geopandas.org/aggregation_with_dissolve.html