Learn R Programming

mapSpain (version 0.1.2)

esp_get_munic: Get municipalities boundaries of Spain

Description

Loads a simple feature (sf) object containing the municipalities boundaries of Spain.

Usage

esp_get_munic(
  year = "2019",
  epsg = "4258",
  cache = TRUE,
  update_cache = FALSE,
  cache_dir = NULL,
  verbose = FALSE,
  region = NULL,
  munic = NULL,
  moveCAN = TRUE
)

Arguments

year, epsg, cache, update_cache, cache_dir, verbose, moveCAN

See esp_get_nuts. Years available: 2001, 2004, 2006, 2008, 2010, 2013 and any year between 2016 and 2019.

region

A vector of names and/or codes for provinces or NULL to get all the municipalities. See Details.

munic

A name or regex expression with the names of the required municipalities. NULL would not produce any filtering.

Value

A POLYGON object.

Details

When using region you can use and mix names and NUTS codes (levels 1, 2 or 3), ISO codes (corresponding to level 2 or 3) or cpro.

When calling a superior level (Province, Autonomous Community or NUTS1) , all the municipalities of that level would be added.

See Also

esp_get_nuts,esp_munic.sf, esp_codelist

Examples

Run this code
# NOT RUN {

library(sf)

Base <- esp_get_munic(region = c("Castilla y Leon"))
SAN <-
  esp_get_munic(
    region = c("Castilla y Leon"),
    munic = c("^San ", "^Santa ")
  )

plot(st_geometry(Base), col = "cornsilk", border = "grey80")
plot(st_geometry(SAN),
     col = "firebrick3",
     border = NA,
     add = TRUE)
# }

Run the code above in your browser using DataLab