[R-sig-Geo] Rgshhs for getting maps around longitude 0
Karl Ove Hufthammer
karl at huftis.org
Thu Oct 14 16:23:58 CEST 2010
Dear list members
The GSHHS map data uses longitudes from 0 to 360, which causes problems
fetching maps around longitude 0. Example:
library(maptools)
gpclibPermit()
gshhs.c.b <- system.file("share/gshhs_c.b", package="maptools")
xl=c(-30,30)
yl=c(50,80)
rmap=Rgshhs(gshhs.c.b, xlim=xl, ylim=yl)
plot(rmap$SP)
There are no error messages, but some countries are just missing, e.g.,
Ireland, Iceland and Greenland. To get a map containing them, we have to use
xlim=c(330,360). But what if we want to have both countries to the east and
to the west of long = 0 on the same map (i.e., SpatialPolygons)?
Rgshhs takes a ‘shift’ argument, but this only changes the *output*
coordinates from 0,360 to -180,180; it doesn’t change the accepted input
variables.
Is it necessary to fetch the map twice? If so, which xlim values should be
used, and how should the two maps be merged into one SpatialPolygons? Note
that if I change ‘xlim’ to c(0,30), Great Britain is missing ... :-(
--
Karl Ove Hufthammer
More information about the R-sig-Geo
mailing list