Learn R Programming

bfsMaps (version 1.99.3)

GetMap: 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)

Value

the map object

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.

Author

Andri Signorell <andri@signorell.net>

Details

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

Examples

Run this code
try( {

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

})

Run the code above in your browser using DataLab