| as_crs | R Documentation |
Standardise the coordinate reference system (CRS) of an object
as_crs(x, allow_geographic = FALSE)
x |
An object of class |
allow_geographic |
Logical, whether to allow geographic CRS (lat/lon). |
An object of class sf::crs with a valid CRS.
library(sf)
# Standardise a numeric EPSG code
as_crs(4326, allow_geographic = TRUE)
# Standardise a character EPSG code
as_crs("EPSG:4326", allow_geographic = TRUE)
# Standardise a bbox object
bb <- st_bbox(c(xmin = 25.9, ymin = 44.3, xmax = 26.2, ymax = 44.5),
crs = 4326)
as_crs(bb, allow_geographic = TRUE)
# Standardise a simple feature object
bb_sfc <- st_as_sfc(bb)
bb_sf <- st_as_sf(bb_sfc)
as_crs(bb_sf, allow_geographic = TRUE)
as_crs(bb_sfc, allow_geographic = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.