[R-sig-Geo] Rgshhs for getting maps around longitude 0

Roger Bivand Roger.Bivand at nhh.no
Sun Oct 17 22:16:57 CEST 2010


On Thu, 14 Oct 2010, Karl Ove Hufthammer wrote:

> 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 ... :-(

As things stand, I suspect that there is no alternative, but will take a 
look (and encourage others to do so too!). Merging with 
unionSpatialPolygons() as usual.

Roger

>
> -- 
> Karl Ove Hufthammer
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Roger Bivand
Economic Geography Section, Department of Economics, Norwegian School of
Economics and Business Administration, Helleveien 30, N-5045 Bergen,
Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand at nhh.no


More information about the R-sig-Geo mailing list