CRS_extracter.Rd
Extracts a coordinate reference system (CRS) from a library of commonly used CRS codes This also fixes issues with the belge lambert 72 we use. The EPSG code is 31370, but the proj4string is not the same as the one in the EPSG database.
CRS_extracter(CRS, EPSG = TRUE)
A CRS object
Other spatial:
apply_grtsdb()
,
calculate_polygon_centroid()
,
collect_osm_features()
if (FALSE) { # \dontrun{
# Example of how to use the CRS_extracter function
crs_wgs <- CRS_extracter("WGS", EPSG = FALSE)
crs_bel <- CRS_extracter("BEL72", EPSG = FALSE)
epsg_wgs <- CRS_extracter("WGS", EPSG = TRUE)
# Example of how to use the CRS_extracter function in combination with the sf & leaflet packages
library(sf)
library(tidyverse)
library(leaflet)
boswachterijen_df <- boswachterijen$boswachterijen_2024 %>%
st_transform(crs_bel) %>%
mutate(centroid = st_centroid(geometry)) %>%
st_drop_geometry() %>%
st_as_sf(sf_column_name = "centroid",
crs = crs_bel) %>%
st_transform(crs_wgs)
leaflet() %>%
addTiles() %>%
addPolylines(data = boswachterijen$boswachterijen_2024) %>%
addCircles(data = boswachterijen_df, color = "red", radius = 1000)
} # }