convertCoords: Convert coordinates from one Coordinate Reference System to...

Description Usage Arguments Details Value Author(s) Examples

View source: R/convertcoords.R

Description

Convert coordinates from one Coordinate Reference System to another

Usage

1
convertCoords(coords, from = 4326, to)

Arguments

coords

a two-column matrix or data frame with easting/longitude in the first column, northing/latitude in the second column

from

the EPSG code for the Coordinate Reference System of the input data (default WGS84)

to

the EPSG code for the CRS of the output data.

Details

For EPSG codes, go to http://spatialreference.org/ref/epsg/ or just Google 'EPSG' with the desired CRS name.

The function requires the 'sp' and 'rgdal' packages.

Value

A data frame or matrix with the converted coordinates.

Author(s)

Mike Meredith

Examples

1
2
3
# A matrix of coordinates
x <- cbind(c(0, 1, 4, 5), c(0, 1, 3, 1))
print(convertCoords(x, to=32631))  # UTM zone 31N

mikemeredith/MMmisc documentation built on Nov. 8, 2019, 11:34 p.m.