addBorders | R Documentation |
add country and Bundesland borders to a map
addBorders(de = "grey80", eu = "black", add = TRUE, ...)
de |
Color for Bundeslaender lines. NA to suppress. DEFAULT: "grey80" |
eu |
Color for countries lines. NA to suppress. DEFAULT: "black" |
add |
Logical: add to existing plot? DEFAULT: TRUE |
... |
Further arguments passed to |
# Use the SpatVectors directly with: DEU <- terra::vect(system.file("extdata/DEU.gpkg", package="rdwd")) EUR <- terra::vect(system.file("extdata/EUR.gpkg", package="rdwd")) # Obtained with the code: url <- "https://gisco-services.ec.europa.eu/distribution/v2/nuts/shp/NUTS_RG_03M_2021_4326_LEVL_1.shp.zip" tf <- tempfile(fileext=".zip") download.file(url, tf) # 0.9 MB # in 2023-06 error 'Transferred a partial file' unzip(tf, exdir="misc/vign") ; rm(url, tf) DEU <- terra::vect("misc/vign/NUTS_RG_03M_2021_4326_LEVL_1.shp") library(terra) # for bracket method DEU <- DEU[DEU$CNTR_CODE=="DE","NUTS_NAME"] terra::writeVector(DEU, "inst/extdata/DEU.gpkg", overwrite=TRUE) url <- "https://gisco-services.ec.europa.eu/distribution/v2/nuts/shp/NUTS_RG_03M_2021_4326_LEVL_0.shp.zip" tf <- tempfile(fileext=".zip") download.file(url, tf) # 0.7 MB # in 2023-06 error 'Transferred a partial file' unzip(tf, exdir="misc/vign") ; rm(url, tf) EUR <- terra::vect("misc/vign/NUTS_RG_03M_2021_4326_LEVL_0.shp") EUR <- terra::crop(EUR, c(-11,25, 40,60)) EUR <- EUR[,"NUTS_NAME"] terra::writeVector(EUR, "inst/extdata/EUR.gpkg", overwrite=TRUE)
invisible list with DEU and EUR
Berry Boessenkool, berry-b@gmx.de, Aug 2019, June 2023
plotRadar
, website raster chapter
if(requireNamespace("terra", quietly=TRUE)){
plot(1, xlim=c(2,16), ylim=c(47,55))
addBorders()
addBorders(add=FALSE)
plot(1, xlim=c(2,16), ylim=c(47,55))
addBorders(de="orange", eu=NA)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.