在R中的Recenter世界地图和shapefile

时间:2018-03-21 15:34:11

标签: r gis geospatial shapefile

我是R中的空间数据分析的新手,我坚持一个特定的问题。我在一个以大西洋为中心的世界地图上覆盖了多个shapefile(默认居中)。我的所有图层都在此视图中导入正常,但我真正想要做的是重新集中在印度太平洋上的所有内容。我知道如何重新定位世界地图,但是当我将我的shapefile添加到重新居中的地图时,它们不再正确地绘制(它们不会被包裹并被切断超过一定的经度)。我假设我可能需要重新格式化每个shapefile中指定的坐标?不确定如何解决此问题。

所有内容如何在大西洋上居中(默认):How everything looks centered over the Atlantic:

我希望我的地图居中,但是shapefile范围被切断/不包裹:How I want my map centered, but shapefile extents dow not wrap and are cut off:

这是我的代码:

map("worldHires") #Used for default centering, works fine with 
                  shapefiles

map("worldHires", wrap=c(0,360), ylim=c(-60,60)) #Used for 
reformatted centering, does not work well with shapefiles

shapefile1 <- rgdal::readOGR("shapefile1.shp")
plot(shapefile1, add=TRUE, col=scales::alpha("darkblue", 0.6), 
    border=FALSE)

shapefile2 <- rgdal::readOGR("shapefile2.shp")
plot(shapefile2, add=TRUE, col=scales::alpha("darkgreen", 0.6), 
    border=FALSE)

shapefile3 <- rgdal::readOGR("shapefile3.shp")
plot(shapefile3, add=TRUE, col=scales::alpha("darkred", 0.6), 
    border=FALSE)

map.axes()

有没有人有解决此问题的建议?提前感谢您的帮助!

0 个答案:

没有答案