0

I am new to GIS and I try to use the following code to display a pacific-centered world map.

+proj=robin +lon_0=-198 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs

However the map displayed is a bit messy as below: enter image description here

I'm wondering whether I can limit the map within two longitude lines to eliminate those horizontal lines. However I don't know the proj4 code to realize this.

1
  • Not tried this out but I think you should split polygons at longitude -18 degrees. Doing this you avoid polygons going beyond the bounds of your projection.
    – Detlev
    Jul 13 '15 at 5:10
1

Use the function nowrapSpatialPolygons at the anti-meridian of your central longitude. This doesn't work with wrld_simpl from maptools, but it does work with countriesLow from rworldmap.

library(rworldmap)
data(countriesLow)
library(maptools)
prj <- "+proj=robin +lon_0=-198 +x_0=0 +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
x0 <- nowrapSpatialPolygons(countriesLow, offset = -18)
x <- spTransform(x0, CRS(prj))
plot(x, col = colorRampPalette(c("yellow", "orange", "brown"))(length(x)))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.