[R] world map matrix

Duncan Murdoch murdoch at stats.uwo.ca
Fri Jun 8 14:39:42 CEST 2007


On 6/8/2007 6:52 AM, Antonio Rodríguez wrote:
> Hi,
> 
> Is it possible to make a world map matrix where land values are set to 0 and
> sea values to 1?

It's not hard to produce a bitmap of a world map with the maps package, 
and then some image manipulation functions could convert it to 0's and 
1's.  I don't know if there's a more direct way.

One minor problem you may encounter is that the default world map 
display isn't really rectangular:  e.g. bits of Siberia that cross 180 
degrees east are still displayed attached to Siberia rather than 
wrapping around and being displayed on the other side of the map.  The 
display also doesn't go all the way to the south pole.  I produced a 
couple of rectangular bitmaps covering 90 south to 90 north and 180 west 
to 180 east; they're included in the rgl package (and used to display 
globes in the persp3d example).

Duncan Murdoch



More information about the R-help mailing list