Skip to content
Prev 23382 / 29559 Next

making wrld_simpl longitude borders something other than (-180, 180)

Ah, this did it:
http://stackoverflow.com/questions/17718928/how-to-switch-to-a-map-that-is-centered-on-the-china-instead-of-the-default-set

(plotting to PDF helps speed it up)

library(geosphere)
library(gdata) # for read.xls
library(maptools) # for e.g. wrld_simpl
library(rgdal)
library(gpclib)   # for polygon clipping

pdffn = "wrld_simpl.pdf"
pdf(file=pdffn, width=12, height=6)

data(wrld_simpl) #The world as a SpatialPolygonsDataFrame
#To avoid the lines crossing the map after reprojection we need to cut the
polygons at the new break:
w <- nowrapRecenter(wrld_simpl, offset = 180-100, avoidGEOS=TRUE)
#Then proceed with the reprojection (note the proj4 string for a mollweide
projection with 150?E as the new center)
wrld_reCentered <- spTransform(w, CRS("+proj=moll +lon_0=-100"))
plot(wrld_reCentered, border="grey", lwd=0.5)


dev.off()
cmdstr = paste0("open ", pdffn)
system(cmdstr)
On Mon, Sep 14, 2015 at 3:46 PM, Nick Matzke <matzke at nimbios.org> wrote: