crs_transform | R Documentation |
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/.
crs_transform(xy.from=NULL,
proj4.from=NULL,
proj4.to=NULL)
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. |
An object of class SpatialPoints fromt the R-package sp
.
This function requires the R-packages rgdal
and sp
Cristian Lussana
# 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]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.