I have two shapefiles in python and I would like to find the area of all spaces they overlap.
I can use sjoin from geopandas to get areas where they join, but for locations where there are multiple overlaps I would like to only keep the one with the largest area.
municipality = gpd.read_file(muni_file)
soil_type = gpp.read_file(soil)
combined = gpd.sjoin(municipality,soil_type,how="left",op="intersects")
With OGR I can get the area of a polygon as below
from osgeo import ogr
wkt = "POLYGON ((1162440.5712740074 672081.4332727483, 1162440.5712740074 647105.5431482664, 1195279.2416228633 647105.5431482664, 1195279.2416228633 672081.4332727483, 1162440.5712740074 672081.4332727483))"
poly = ogr.CreateGeometryFromWkt(wkt)
So I am wondering if there is a way to take my combined shapefile and have the area where the two intersect so that I only keep the maximum one for each municipality.