I have 2 geodataframes:
- GDF1 is an area with overlapping polygons divided into 3 classes: (cleaning, infra and maintenance) (the black lines donates the overlapping polygons)
- GDF2 consists of polygons describing the type of the area's surface, like gras, sand, buildings, water etc (the colors donate the type of area's surface)
I want to calculate: what kind of land_use_type (from GDF2) each polygon from GDF1 consists.
What i tried is :
GDF1 = gpd.GeoDataFrame.from_postgis('select class, geom_sm as geom
From geo.GDF1',
con=engine, geom_col='geom')
GDF2 = gpd.GeoDataFrame.from_postgis('SELECT land_use_type,wkb_geometry_sm as geom
FROM geo.GDF2',
con=engine, geom_col='geom')
I calculated the area of each land_use_type polygons:
GDF2["area"] = GDF2['geom'].area
And after that i merged on GDF1
merged = gpd.sjoin(GDF1, GDF2, how='left', op='intersects')
I got a new column with areas but I am not sure if that's the right calculation.