1. 读取 shp/geojson 边界文件
import geopandas as gpd
file = 'media/abc.geojson'
gdf = gpd.read_file(file)
# 将 GeoDataFrame 转换为 GeoJSON 字符串
geojson = json.loads(gdf.to_json())
features = geojson['features']
2. 获取 边界文件的网格范围
import geopandas as gpd
file = 'media/abc.geojson'
gdf = gpd.read_file(file)
grid_bounds = gdf.total_bounds
# 返回一个列表, 包含 最小经度, 最小纬度, 最大经度, 最大纬度
res = grid_bounds.tolist()
标签:shp,file,Python,geopandas,geojson,gpd,gdf
From: https://www.cnblogs.com/jessecheng/p/17846597.html