Make a union of polygons in GeoPandas, or Shapely (into a single geometry)

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()

union

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)