Learn R Programming

rgdal (version 0.7-7)

project: Projection of coordinate matrices

Description

Interface to the PROJ.4 library of projection functions for geographical position data, no datum transformation possible. Use spTransform() for extended support.

Usage

project(xy, proj, inv = FALSE)

Arguments

xy
2-column matrix of coordinates
proj
character string of projection arguments; the arguments must be entered exactly as in the PROJ.4 documentation, in particular there cannot be any white space in += strings, and successive such strings can only be separated by blanks.
inv
default FALSE, if TRUE inverse projection to geographical coordinates

Value

  • A two column matrix with projected coordinates.

Details

Full details of projection arguments available from website below, and examples in file "epsg" in the data directory installed with PROJ.4.

References

http://proj.maptools.org/

See Also

CRS-class, spTransform-methods

Examples

Run this code
data(state)
res <- project(cbind(state.center$x, state.center$y),
 "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100")
res1 <- project(res, "+proj=lcc +lat_1=48 +lat_2=33 +lon_0=-100", inv=TRUE)
summary(res1 - cbind(state.center$x, state.center$y))
plot(cbind(state.center$x, state.center$y), asp=1, type="n")
text(cbind(state.center$x, state.center$y), state.abb)
plot(res, asp=1, type="n")
text(res, state.abb)

Run the code above in your browser using DataLab