import geopandas as gpd
from shapely.geometry import Point
#坐标转换的脚本,支持任何坐标的转换
# 要转换的4326标
x4326 = 13394266.8800
y4326 = 4333416.96
# 创建Geopandas的GeoDataFrame
gdf = gpd.GeoDataFrame(geometry=[Point(x4326, y4326)], crs="EPSG:3857")
# # 从EPSG:2000转换为EPSG:3857
# gdf = gdf.to_crs("EPSG:3857")
# 从EPSG:2000转换为EPSG:4326
gdf2 = gdf.to_crs("EPSG:4326")
#
# # 提取3857坐标
# x3857 = gdf.geometry.x[0]
# y3857 = gdf.geometry.y[0]
x4326 = gdf2.geometry.x[0]
y4326 = gdf2.geometry.y[0]
print("4326坐标:", x4326, y4326)
print("转换后")
# print("3857坐标:", x3857, y3857)
如何利用python脚本对坐标系进行转换(3857转4326)
最新推荐文章于 2024-05-30 11:43:13 发布