我正在使用默认地图,例如:
world = geopandas.read_file(gpd.datasets.get_path('naturalearth_lowres'))
我可以使用以下 for 循环示例从另一个 GeoDataFrame(此处称为 sample_gdf)成功地将标签注释到此地图:
for idx, row in sample_gdf.iterrows():
plt.annotate(text=row['country_name'], # e.g. this column contains the names of each countries
xy=(row['longitude'], row['latitude']), # e.g. these columns are showing the coordinates of middle points of each countries
horizontalalignment='center')
这就是 epsg=4326 的样子 当我想更改地图的投影时,问题就开始了。上面变量“世界”的默认 CRS 是 epsg:4326。只要我像这样更改投影:
world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))
world = world.to_crs(epsg=3035)
专注于欧洲,我的标签不再出现在正确的位置。我一直在寻找解决这个问题的建议一个星期,但现在找不到任何解决方案。谢谢你的帮助。 这就是 epsg=3035标签出现在左下角的样子。