#' Add addtitional location information to the accident location (cities)
#'
#' @param data the traffic accident data
#'
#' @return the traffic accident data with location information
#' @export
#'
#' @importFrom sf st_read
#' @importFrom sf st_cast
#' @importFrom sf st_transform
#' @importFrom sf st_zm
#' @importFrom sf st_intersection
#' @importFrom utils download.file
#' @importFrom utils unzip
#'
add_locations <- function(data) {
temp <- tempfile()
download.file(
"https://daten.gdz.bkg.bund.de/produkte/sonstige/ge250/aktuell/ge250.gk3.shape.zip",
temp
)
unzip(temp)
amr <- st_read("./ge250.gk3.shape/ge250/amr250/AMR250.shp")
amr <- st_transform(amr, 25832)
data <- st_zm(data)
data <- st_intersection(data, amr)
return(data)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.