问题:跨越国际日期变更线的多边形经常有南北线穿过。rnaturalearth 包中的俄罗斯东部就是一个很好的例子,但我在其他空间数据中也遇到过这种情况。我希望能够删除这条线以进行绘图。
尝试: 我主要使用R中的sf包进行映射。我尝试了各种解决方案,包括 st_union、st_combine、st_wrap_dateline、st_remove_holes,以及使用其他包中的函数(例如aggregate、merge 和 gUnaryUnion),但到目前为止我的努力没有结果。
示例:以下代码使用流行的 rnaturalearth 包演示了俄罗斯沿国际日期变更线的问题线。
library(tidyverse)
library(rnaturalearth)
library(sf)
#Import data
world <- ne_countries(scale = "medium",
returnclass = "sf")
#I use the Alaska albers projection for this map,
#limit extent (https://spatialreference.org/ref/epsg/nad83-alaska-albers/)
xmin <- -2255938
xmax <- 1646517
ymin <- 449981
ymax <- 2676986
#plot
ggplot()+
geom_sf(data=world, color="black", size=1)+
coord_sf(crs=3338)+
xlim(c(xmin,xmax))+ylim(c(ymin,ymax))+
theme_bw()
Run Code Online (Sandbox Code Playgroud)
谢谢!