GetMap: Load a Map

View source: R/bfsMaps.R

GetMapR Documentation

Load a Map

Description

GetMap directly looks up the path of a map based on a shortcut name or number, loads the map from this location and returns the object.

Usage

GetMap(name_x, basedir = getOption("bfsMaps.base",
       default = file.path(find.package("bfsMaps"), "extdata")),
       crs = 2056)

Arguments

name_x

the name of a map, currently supported are "kant.map", "bezk.map", "polg.map", "greg.map", "ch.map" or any number referring to a row in the 'maps.csv' file.

basedir

the root directory for the maps to reside. bfsMaps by default looks for the mapfiles in its install location in the extdata directory. The basedir can be set as an option too.

crs

Coordinate reference system (default 2056) for the map, if not set to NA the map will be transformed to this crs.

Details

Loading the cards no longer causes performance problems and can thus be performed directly.

Value

the map object

Author(s)

Andri Signorell <andri@signorell.net>

Examples

try( {

# use map containing Swiss metropolitan regions
mymap <- GetMap("metr.map")$geometry
PlotCH()
plot(mymap, col=Pal("Helsana"), add=TRUE, border=NA)

})

bfsMaps documentation built on July 9, 2023, 5:57 p.m.