spatial_convert function

Convert coordinates between reference systems

Convert coordinates between reference systems

Coordinates are converted between reference systems.

spatial_convert(data, from, to)

Arguments

  • data: Numeric vector of length two or data frame, x-, y-coordinates to be converted.
  • from: Character value, proj4 string of the input reference system.
  • to: Character value, proj4 string of the output reference system.

Returns

Numeric data frame with converted coordinates.

Examples

## create lat lon coordinates xy <- c(13, 55) ## define output coordinate systems proj_in <- "+proj=longlat +datum=WGS84" proj_out <- "+proj=utm +zone=32 +datum=WGS84" ## convert coordinate pair spatial_convert(data = xy, from = proj_in, 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, from = proj_in, to = proj_out)

Author(s)

Michael Dietze

  • Maintainer: Michael Dietze
  • License: GPL-3
  • Last published: 2025-03-25

Useful links