Learn R Programming

TeachingDemos (version 1.2)

project.Map: Apply projections to Map objects (from maptools package)

Description

Apply the mapproject function from the mapproj library to Map objects from the maptools library.

Usage

project.Map(Map, projection = "", parameters = NULL, orientation = c(90, 0, 0))

Arguments

Map
A Map object.
projection
See mapproject
parameters
See mapproject
orientation
See mapproject

Value

  • An object of class Map with the coordinates transformed.

Details

This function takes a Map object and applies mapproject from the mapproject library to it.

See Also

mapproject from the mapproj library.

Examples

Run this code
library(mapproj)
# assumes that the time zone shape files have been downloaded
# from: http://openmap.bbn.com/data/shape/timezone/

tz <- read.shape('WRLDTZA')
plot(Map2poly(project.Map(tz,'bonne',param=45)))

plot(Map2poly(project.Map(tz,'bonne',param=45)),
  col=rainbow(48)[tz$att.data$OFFSET])

plot(Map2poly(project.Map(tz,'albers',param=c(30,40))))

Run the code above in your browser using DataLab