Automatically detects whether it is a vector or raster map and uses the appropriate read function.

load_layer(x)

Arguments

x

File name with full path

Value

A Spatial* object for vector maps and a RasterLayer object for raster maps.

Examples

(pkg_layers <- list.files( system.file("cartography/CMR", package = "mapMCDA"), full.names = TRUE ))
#> [1] "/tmp/RtmpHyxCwO/temp_libpath47a4216f4efb/mapMCDA/cartography/CMR/animal.density.tif" #> [2] "/tmp/RtmpHyxCwO/temp_libpath47a4216f4efb/mapMCDA/cartography/CMR/cmr_admin3.gpkg" #> [3] "/tmp/RtmpHyxCwO/temp_libpath47a4216f4efb/mapMCDA/cartography/CMR/mobility.csv" #> [4] "/tmp/RtmpHyxCwO/temp_libpath47a4216f4efb/mapMCDA/cartography/CMR/national_parks.gpkg" #> [5] "/tmp/RtmpHyxCwO/temp_libpath47a4216f4efb/mapMCDA/cartography/CMR/water_bodies.gpkg"
epiunits <- load_layer(pkg_layers[[2]])