要获取 shapefile 的四个角点的经纬度,你可以使用 geopandas 库中的方法来读取 shapefile,并使用 GeoDataFrame 的 bounds 属性来获取 shapefile 的边界框。边界框是一个包含最小纬度、最小经度、最大纬度和最大经度的元组。下面是一个示例代码:

import geopandas as gpd

# 读取 shapefile
gdf = gpd.read_file('path_to_shapefile.shp')

# 获取边界框
min_lon, min_lat, max_lon, max_lat = gdf.bounds.values[0]

print('最小经度:', min_lon)
print('最小纬度:', min_lat)
print('最大经度:', max_lon)
print('最大纬度:', max_lat)

请确保将 'path_to_shapefile.shp' 替换为实际的 shapefile 文件路径。这段代码将打印出 shapefile 的四个角点的经纬度。

使用 Geopandas 获取 Shapefile 四个角点的经纬度

原文地址: https://www.cveoy.top/t/topic/qDoE 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录