More

How to display the map within two longitude lines

How to display the map within two longitude lines


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:

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.


Use the functionnowrapSpatialPolygonsat the anti-meridian of your central longitude. This doesn't work withwrld_simplfrom maptools, but it does work withcountriesLowfrom 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)))