Note: cascaded_union
mentioned in the answer below 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)
From the question/answer here, it seems this is called a cascaded_union
within shapely
:
from shapely.ops import cascaded_union
polygons = [poly1[0], poly1[1], poly2[0], poly2[1]]
boundary = gpd.GeoSeries(cascaded_union(polygons))
boundary.plot(color="red")
plt.show()