Learn R Programming

eseis (version 0.6.0)

spatial_convert: Convert coordinates between reference systems

Description

Coordinates are converted between reference systems.

Usage

spatial_convert(data, to)

Value

Numeric data frame with converted coordinates.

Arguments

data

Numeric vector of length two or data frame, x-, y-coordinates to be converted.

to

Character value, proj4 string of the output reference system.

Author

Michael Dietze

Examples

Run this code

## create lat lon coordinates
xy <- c(13, 55)

## define output coordinate system 
proj_out <- "+proj=utm +zone=32 +datum=WGS84"

## convert coordinate pair
spatial_convert(data = xy, 
                to = proj_out)
                
## define set of coordinates
xy <- data.frame(x = c(10, 11),
                 y = c(54, 55))
                 
## convert set of coordinates
spatial_convert(data = xy, 
                to = proj_out)
                     

Run the code above in your browser using DataLab