Skip to contents

Loads and returns names, id, and coordinates for Germany statistical unit, to use with mapping functions and other "map" functions that accept an sf object.

Usage

loadCoordDE(unit = c("state", "district", "municipal", "municipality"), 
            unit_subset = NULL, matchWith = NULL, dir = NULL, 
            use_cache = TRUE, use_internet = TRUE, crs = NULL)

Arguments

unit

the type of Italian statistical unit to link

unit_subset

character vector of unit names to extract

matchWith

the type of id

dir

local directory in which shape files are stored

use_cache

a logical value indicating whether to use the cache

use_internet

a logical value indicating wheter the coordinates are downloaded from https://github.com/mappinguniverse/geospatial. If FALSE the maps downloaded during package installation will be used

crs

coordinate reference system. Look at st_crs

Details

Coordinates are download from the Github repo https://github.com/mappinguniverse/geospatial from DE folder https://github.com/mappinguniverse/geospatial/tree/master/DE.

If unit is not specified, state borders are loaded.

Value

A data.frame object with column indicating names, id, and the geometry to map.

Author

Alessio Serafini

Examples



DE_coords = loadCoordDE(unit = "state")
str(DE_coords)
#> Classes ‘sf’, ‘DE’ and 'data.frame':	16 obs. of  5 variables:
#>  $ code_state: chr  "07" "05" "02" "08" ...
#>  $ code      : chr  "073150000000" "051110000000" "020000000000" "081110000000" ...
#>  $ state     : chr  "rheinland-pfalz" "nordrhein-westfalen" "hamburg" "baden-w\xfcrttemberg" ...
#>  $ state_type: chr  "land" "land" "freie und hansestadt" "land" ...
#>  $ geometry  :sfc_MULTIPOLYGON of length 16; first list element: List of 1
#>   ..$ :List of 1
#>   .. ..$ : num [1:9899, 1:2] 7.81 7.8 7.8 7.79 7.79 ...
#>   ..- attr(*, "class")= chr [1:3] "XY" "MULTIPOLYGON" "sfg"
#>  - attr(*, "sf_column")= chr "geometry"
#>  - attr(*, "agr")= Factor w/ 3 levels "constant","aggregate",..: NA NA NA NA
#>   ..- attr(*, "names")= chr [1:4] "code_state" "code" "state" "state_type"
#>  - attr(*, "unit")= chr "state"
#>  - attr(*, "colID")= chr "state"


# \donttest{

## Load subset

coords_de <- loadCoordDE(unit = "district", 
                         unit_subset = "bayern", 
                         matchWith = "state")

# }