Skip to contents

This function allows you to download the latest version of the geometry and ubigeos corresponding to the official political division of the departament boundaries of Peru. For more information, you can visit the following page INEI Spatial Data Portal.

Usage

get_departaments(dsn = NULL, show_progress = TRUE, quiet = TRUE, timeout = 60)

Arguments

dsn

Character. Path to the output .gpkg file or a directory where the file will be saved. If a directory is provided, the file will be saved as DEPARTAMENTO.gpkg inside it. If NULL, a temporary file will be created. If the path contains multiple subdirectories, they will be created automatically if they do not exist.

show_progress

Logical. Suppress bar progress.

quiet

Logical. Suppress info message.

timeout

Seconds. Number of seconds to wait for a response until giving up. Cannot be less than 1 ms. Default is 60.

Value

An sf or tibble object.

Examples

# \donttest{
library(geoidep)
dep <- get_departaments(show_progress = FALSE)
head(dep)
#> Simple feature collection with 6 features and 6 fields
#> Geometry type: MULTIPOLYGON
#> Dimension:     XY
#> Bounding box:  xmin: -79.45857 ymin: -17.28501 xmax: -70.80408 ymax: -2.986125
#> Geodetic CRS:  WGS 84
#>   id objectid ccdd   nombdep shape_length shape_area
#> 1  1        1   01  AMAZONAS    13.059047   3.199147
#> 2  2        2   02    ANCASH    11.788249   2.954697
#> 3  3        3   03  APURIMAC     7.730154   1.765933
#> 4  4        4   04  AREQUIPA    17.459435   5.330125
#> 5  5        5   05  AYACUCHO    17.127166   3.643705
#> 6  6        6   06 CAJAMARCA    12.540288   2.688386
#>                             geom
#> 1 MULTIPOLYGON (((-77.81399 -...
#> 2 MULTIPOLYGON (((-77.64697 -...
#> 3 MULTIPOLYGON (((-73.74655 -...
#> 4 MULTIPOLYGON (((-71.98109 -...
#> 5 MULTIPOLYGON (((-74.34843 -...
#> 6 MULTIPOLYGON (((-78.70034 -...
# }