crs_transform: transformation of coordinates between coordinate reference...

crs_transformR Documentation

transformation of coordinates between coordinate reference systems

Description

Transformation of coordinates between coordinate reference systems (CRSs). The CRS are specified with proj4 strings http://proj4.org/. A list of proj4 string can be found at http://spatialreference.org/.

Usage

crs_transform(xy.from=NULL,
              proj4.from=NULL,
              proj4.to=NULL)

Arguments

xy.from

data frame with two columns: x and y. They are the Easting and Northing coordinates to be transformed.

proj4.from

proj4 string specifying the CRS for xy.from.

proj4.to

proj4 string specifyng the CRS for the transformed coordinates.

Value

An object of class SpatialPoints fromt the R-package sp.

Note

This function requires the R-packages rgdal and sp

Author(s)

Cristian Lussana

Examples


# load libraries
library(gibson)
# transformation from long-lat to UTM33 CRSs
res<-crs_transform(data.frame(x=c(45,50),y=c(12,0)),proj4.from="+proj=longlat +datum=WGS84",proj4.to="+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
# from SpatialPoins object to a matrix
mat<-coordinates(res)
x.to<-mat[,1]
y.to<-mat[,2]

metno/gibson documentation built on Feb. 12, 2024, 7:25 a.m.