You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用GeoPandas to_crs转换至EPSG:3347时投影异常求助

问题描述

将世界地图数据转换至EPSG:3035投影时显示正常:

import geopandas as gpd
import matplotlib.pyplot as plt
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.to_crs('epsg:3035').plot()
plt.show()

正常投影效果

但更换为EPSG:3347投影时出现异常,生成的投影未以北美为中心:

import geopandas as gpd
import matplotlib.pyplot as plt
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.to_crs('epsg:3347').plot()
plt.show()

错误投影效果

EPSG:3347的正确投影应以北美洲为中心。当前使用的包版本:

pyproj.__version__ = 3.3.1
gpd.__version__    = 0.12.2
解决方法

方法1:手动调整显示范围

EPSG:3347的有效坐标范围大致为x: -3415643 到 3415643,y: -3330142 到 3330142。绘图时指定该范围即可纠正显示:

import geopandas as gpd
import matplotlib.pyplot as plt

world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world_3347 = world.to_crs('epsg:3347')
ax = world_3347.plot()
ax.set_xlim(-3415643, 3415643)
ax.set_ylim(-3330142, 3330142)
plt.show()

方法2:使用完整PROJ字符串定义投影

部分场景下直接调用EPSG代码可能存在参数解析偏差,改用完整PROJ字符串可避免该问题:

import geopandas as gpd
import matplotlib.pyplot as plt

proj_3347 = '+proj=lcc +lat_1=49 +lat_2=77 +lat_0=49 +lon_0=-95 +x_0=0 +y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs'
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world.to_crs(proj_3347).plot()
plt.show()

方法3:更新依赖包

旧版本pyproj可能存在EPSG代码解析错误,更新到最新版本可修复部分兼容性问题:

pip install --upgrade pyproj geopandas

内容的提问来源于stack exchange,提问作者paugam

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.21 08:57:22