View source: R/transform-projection.R
transform_crs | R Documentation |
Transform between Coordinate Reference Systems
transform_crs(data, coord, in_crs, out_crs, append = TRUE)
transform_LV95_to_WSG84(data, coord = c(lon = "x", lat = "y"), append = TRUE)
transform_WSG84_to_LV95(data, coord = c(x = "lon", y = "lat"), append = TRUE)
transform_LV03_to_WSG84(data, coord = c(lon = "x", lat = "y"), append = TRUE)
transform_WSG84_to_LV03(data, coord = c(x = "lon", y = "lat"), append = TRUE)
data |
input data |
coord |
mappping of columns for Conversion |
in_crs |
source coordinate reference system as sp::CRS |
out_crs |
target coordinate reference system as sp::CRS |
append |
append data in new Columns |
tibble with transformed coordinates
See Tiles à la Google Maps for a detailed explanation. In Short:
EPSG:4326 uses a coordinate system on the surface of a sphere or ellipsoid of reference.
EPSG:3857 uses a coordinate system PROJECTED from the surface of the sphere or ellipsoid to a flat surface.
Usually Packages and Webservices expects coordinates for Elements in EPSG:4326, one Exception is
leaflet::addRasterImage()
R spatial is migrating to PROJ6+ and gdal3+. At the moment the sp::spTransform isn't converted to use the WKT comments, and rgdal raises some Warnings. The transformation are done correctly.
sp::spTransform()
sp::proj4string()
sp::CRS
fn <- system.file("extdata", "meta_smn.rds", package = "rOstluft.data")
data <- readRDS(fn)
data <- dplyr::distinct(data, site, x, y)
transform_crs(
data = data,
coord = c(lon = "x", lat = "y"),
in_crs = sf::st_crs("EPSG:2056"),
out_crs = sf::st_crs("EPSG:4326")
)
transform_crs(
data = data,
coord = c(lon = "x", lat = "y"),
in_crs = sf::st_crs("EPSG:2056"),
out_crs = sf::st_crs("EPSG:4326"),
append = FALSE
)
transform_LV95_to_WSG84(data)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.