[R-sig-Geo] seamless maps

Roger Bivand Roger.Bivand at nhh.no
Thu Jan 8 14:27:24 CET 2009


On Thu, 8 Jan 2009, Hans-Jörg Bibiko wrote:

> Hi,
>
> I wonder if there's a workaround to generate seamless maps based on 
> SpatialPolygons objects. E.g. to produce a map showing Australia at the left 
> edge and America at the right one ( xlim := min: 110°E , max: 30°W ).
> Or the way around, is there a function to re-center a given map by defining 
> the median longitude? (I know the function 'recenter' which produce a map 
> from 0° to 360°)

Not without recentering, I think. As you've probably found out:

library(maptools)
load(url("http://spatial.nhh.no/R/etc/TM_WORLD_BORDERS_SIMPL-0.2.RData"))
rc <- recenter(world_simp)

gives nasty artefacts where polygons cross the Prime Meridian, so subsets 
of countries crossing 180° and west of but not crossing the Prime Meridian 
need to be recentered, and added back into the object. That is a good deal 
of work. Do you need the country polygons, or can you manage with just the 
shoreline (as polygons):

gshhs.c.b <- system.file("share/gshhs_c.b", package="maptools")
Px <- c(110, 330)
Py <- c(-62, 90)
P <- Rgshhs(gshhs.c.b, xlim=Px, ylim=Py, level=1)
plot(P$SP)

A coarse borders file is also available, but only as lines, and varies in 
levels of detail between countries see ?Rgshhs.

If you do need the country polygons, we'd need to list the blocks 
of polygons needing recentering. The maps package also has Pacific view 
databases for shorelines and some borders.

Hope this helps,

Roger

>
> Kind regards,
>
> --Hans
> _______________________________________________
> 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