缓冲多边形的Geopandas重新投影导致条纹遍布整个地球

问题描述


我有以下问题:我想在www.naturalearthdata.com上的shapefile海岸线周围以米为单位创建缓冲区。
public partial class AlertDetails : Form

因此,我首先需要将shapefile投影到以米为单位的CRS(坐标参考系统)中。我为此使用WGS 84 /伪墨卡托(epsg:3857)。

到目前为止我的工作流程:

partial class AlertDetails

同时绘制缓冲区和原始海岸线看起来不错:

$ wget https://www.naturalearthdata.com/http//www.naturalearthdata.com/download/50m/physical/ne_50m_coastline.zip
$ unzip ne_50m_coastline.zip -d coastlines

enter image description here


放大Spitzbergen:

import geopandas as gpd
import matplotlib.pyplot as plt

shapefile = "coastlines/ne_50m_coastline.shp"
# read shapefile with geopandas and specify the initial CRS (units: degree)
gdf = gpd.read_file(shapefile,crs={'init' :'epsg:4326'})
# Then convert it to the target CRS (units: meter)
gdf = gdf.to_crs(epsg=3857)
# Now create a buffer zone of 100 km around the coastlines
bfr = gdf.geometry.buffer(100*1e3)

enter image description here


直到这里,一切都按预期进行。

但是,如果现在我想将数据投影回标准WGS 84(epsg:4326),我会得到横跨整个地图的条纹,这可能是由于边缘处的开放多边形造成的。

bfr.plot(alpha=.7)
gdf.plot(ax=plt.gca(),color='k',lw=.75)
plt.gca().set_xlim([1000000,3300000])
plt.gca().set_ylim([13000000,16500000]);

enter image description here

奇怪的事情:如果我重新投影到epsg:3857,这些条纹也会出现在Pseudo-Mercator投影中(请参见上面的第一个缓冲区图)。因此,似乎第一次重新投影到epsg:4326会以某种方式导致此问题。
任何想法如何解决这个问题?提前非常感谢您提供任何答案!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)