跳转至

GeoPandas

GeoPandas is an open source project to make working with geospatial data in python easier.

按属性分割

1
2
3
4
gdf = geopandas.read_file("path/to/file.shp")
for cnty_code, sub in gdf.groupby("cnty_code"):
    out_path = f"code_{str(cnty_code)}.csv"
    sub.drop(columns=["geometry"]).sort_values(by="code").to_csv(out_path, index=False, encoding="utf-8")

评论