sp_transform: Transform coordinates

Description Usage Arguments Value Examples

View source: R/spatial.R

Description

For transformations involving NAD27 coordinates ("+datum=NAD27"), custom parameters for Alaska (excluding Aleutian islands) are automatically applied ("+towgs84=-5,135,172"). See http://web.archive.org/web/20130905025856/http://surveying.wb.psu.edu/sur351/DatumTrans/datum_transformations.htm.

Usage

1
sp_transform(xy, from, to, cols = 1:2)

Arguments

xy

Data.frame or numeric vector (coerced to single-row data.frame).

from

Current proj.4 string.

to

Target proj.4 string.

cols

Column numbers or names specifying which xy columns are x and y coordinates.

Value

Object of the same class and dimensions as xy with coordinates transformed in place.

Examples

1
2
3
4
5
6
7
8
xy <- c(-147.25079, 61.18586, 505)
sp_transform(xy, "+proj=longlat +datum=WGS84", "+proj=utm +zone=6")
xy <- c(x = -147.25079, y = 61.18586, z = 505)
sp_transform(xy, "+proj=longlat +datum=WGS84", "+proj=utm +zone=6")
xy <- data.frame(z = 505, x = -147.25079, y = 61.18586)
sp_transform(xy, "+proj=longlat +datum=WGS84", "+proj=utm +zone=6", cols = c("x", "y"))
xy <- data.frame(x = c(NA, -147.25079), y = c(NA, 61.18586), z = 505)
sp_transform(xy, "+proj=longlat +datum=WGS84", "+proj=utm +zone=6")

columbia-glacier/cgr documentation built on Aug. 20, 2017, 5:49 p.m.