geopandas CRS设置与转换

import geopandas
path = "F:\\shapefile\\Xian\\Xian\\Xian.shp"
gdf=geopandas.read_file(path)


gdf.set_crs(epsg=4326,inplace=True)
print(gdf.crs)
print(gdf.total_bounds)
gdf=gdf[gdf.boundary.is_simple]
gdf.to_crs(epsg=3395,inplace=True)
print(gdf.crs)
print(gdf.total_bounds)

注意,在转换CRS之前,需进行自相交检查,否则会报错!

猜你喜欢

转载自blog.csdn.net/qq_40268672/article/details/108012624