我有一个世界国家的形状文件,从下载here http://thematicmapping.org/downloads/TM_WORLD_BORDERS-0.3.zip。我可以使用 R 在 R 中绘制它
countries <- readOGR("shp","TM_WORLD_BORDERS-0.3",encoding="UTF-8",stringsAsFactors=F)
par(mar=c(0,0,0,0),bg=rgb(0.3,0.4,1))
plot(countries,col=rgb(1,0.8,0.4))
现在我想用正交投影(从外太空看到的地球)来绘制它,所以我正在尝试
countries <- spTransform(countries,CRS("+proj=ortho +lat_0=-10 +lon_0=-60"))
我还使用了 x_0 和 y_0 参数(如上所述here http://www.remotesensing.org/geotiff/proj_list/orthographic.html),但我总是收到错误:
non finite transformation detected:
[1] 45.08332 39.76804 Inf Inf
Erro em .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, :
failure in Polygons 3 Polygon 1 points 1
Além disso: Mensagens de aviso perdidas:
In .spTransform_Polygon(input[[i]], to_args = to_args, from_args = from_args, :
108 projected point(s) not finite
有时在第三个多边形,有时在第七个多边形。那些“Inf”从哪里来?我需要更改任何参数吗?我想像这样绘制地图
但以南美洲为中心。感谢您的帮助!