I have a layer with polygons (buildings) and I would like create a polygon that limits the area where the polygons are using geopandas or other python module
SO I have these buildings:
and I would like to have a new layer with a polygon that covers all buildings:
so this:
where it covers the building polygons area . It can be that also a polygon that covers all the buildings and not goes exactly on the vertices of the outside buildings.
Using geopandas
you could apply unary_union
to create a multipolygon out of your polygons and then use convex_hull
:
import geopandas as gpd
gdf1 = gpd.read_file(r"C:\Users\X\Desktop\testpoly.shp")
gdf2 = gpd.GeoDataFrame(geometry=[gdf1.unary_union.convex_hull], crs="EPSG:4326")
gdf1.plot()
gdf2.plot()