我有两个python的shapefile,我想找到它们重叠的所有空间的区域。两个Shapefile的交集区域 - Python
我可以使用来自geopandas的sjoin获取它们加入的区域,但对于存在多个重叠区域的位置,我只想保留具有最大区域的区域。
municipality = gpd.read_file(muni_file)
soil_type = gpp.read_file(soil)
combined = gpd.sjoin(municipality,soil_type,how="left",op="intersects")
随着OGR我可以得到一个多边形的面积如下
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)
所以我想知道如果有一种方法把我的组合shape文件,并有区里的两个相交,使我只保留每个城市的最大值。