geopandas 世界地图的极地立体投影

Polar Stereographic projection of geopandas world map

我想使用 geopandas 包含的低分辨率世界地图(参见 here)作为我的数据的背景。只要我使用例如,这就可以正常工作'PlateCarree'投影。

如果我现在想使用极立体投影

ccrs.NorthPolarStereo()

ccrs.SouthPolarStereo()

没用。

我的代码看起来像这样(使用 python 3)

import geopandas as gpd
import cartopy.crs as ccrs

crs = ccrs.NorthPolarStereo()
crs_proj4 = crs.proj4_init
world = gpd.read_file(gpd.datasets.get_path("naturalearth_lowres"))
w = world.to_crs(crs_proj4)
w.plot(facecolor='sandybrown', edgecolor='black',)

知道极地立体投影是否对这张地图不起作用(如果是,为什么?)还是我做错了什么?

当使用特定的 cartopy 投影绘图时,最好使用 cartopy 实际创建 matplotlib 图和轴,以确保它知道投影(在技术术语中:确保它是 GeoAxes,参见 https://scitools.org.uk/cartopy/docs/latest/matplotlib/intro.html):

crs = ccrs.SouthPolarStereo()
crs_proj4 = crs.proj4_init
w = world.to_crs(crs_proj4)

fig, ax = plt.subplots(subplot_kw=dict(projection=crs))
w.plot(ax=ax, facecolor='sandybrown', edgecolor='black')

但是,这似乎仍然绘制了超出范围的形状。使用 cartopy add_geometries 方法,这更好地尊重范围:

fig, ax = plt.subplots(subplot_kw=dict(projection=crs))
ax.add_geometries(w['geometry'], crs=crs, facecolor='sandybrown', edgecolor='black')

这乍一看有点奇怪(中间的南极洲很小),但这似乎是意料之中的(参见https://scitools.org.uk/cartopy/docs/latest/crs/projections.html#southpolarstereo)。

一般来说,请参阅文档中有关结合 GeoPandas 和 cartopy 的示例:https://geopandas.readthedocs.io/en/latest/gallery/cartopy_convert.html