
Autonomous Communities and Cities of Spain from SIANE
Source:R/esp-get-ccaa-siane.R
esp_get_ccaa_siane.RdReturn Autonomous Communities and Cities of Spain at a specified scale.
Source
CartoBase ANE (Atlas Nacional de España) provided by Instituto Geográfico Nacional (IGN), https://www.ign.es/web/ign/portal. Data are available from 2005 to the present.
Copyright: https://centrodedescargas.cnig.es/CentroDescargas/cartobase-ane
Always acknowledge authorship using the following statements:
When the original digital product is not modified or altered, use one of the following statements:
CartoBase ANE 2006-2024 CC-BY 4.0 ign.es.
CartoBase ANE 2006-2024 CC-BY 4.0 Instituto Geográfico Nacional.
When a new product is generated:
Obra derivada de CartoBase ANE 2006-2024 CC-BY 4.0 ign.es.
Data distributed through the sianedata data branch, see
https://github.com/rOpenSpain/mapSpain/tree/sianedata.
Arguments
- ccaa
Character string. A vector of names, codes or both for Autonomous Communities and Cities, or
NULLto get all Autonomous Communities and Cities. See Details.- year
Character string or number. Release year. It must use format
YYYY(assuming end of year) orYYYY-MM-DD. Historical information starts as of 2005.- epsg
Character string or number. Projection of the map: 4-digit EPSG code. One of:
"4258": ETRS89."4326": WGS84."3035": ETRS89 / ETRS-LAEA."3857": Pseudo-Mercator.
- cache
Logical. Whether to cache downloaded files. Defaults to
TRUE. See Caching.- update_cache
Logical. If
TRUE, refreshes the cached file and forces a new download. Defaults toFALSE.- cache_dir
Character string. A path to a cache directory. See Caching.
- verbose
A logical value indicating whether to display informational messages.
- resolution
Character string or number. Resolution of the geospatial data. One of:
"10": 1:10 million."6.5": 1:6.5 million."3": 1:3 million.
- moveCAN
A logical
TRUE/FALSEor a vector of coordinatesc(lat, lon). It places the Canary Islands close to Spain's mainland. Initial position can be adjusted using the vector of coordinates. See Displacing the Canary Islands inesp_move_can().- rawcols
Logical. If
TRUE, retains the raw columns of the resulting object as provided by IGN.
Value
An sf object.
Details
When using ccaa you can use and mix names and NUTS codes (levels 1 or 2),
ISO codes (corresponding to level 2) or codauto (see esp_codelist).
Ceuta and Melilla are included at the Autonomous Communities and Cities
level in this function.
When calling a NUTS 1 level, all Autonomous Communities and Cities of that level are added.
Caching
Functions that download data store files in cache_dir. When cache_dir
is NULL, they use the active package cache, which defaults to a temporary
directory. Set update_cache = TRUE to replace an existing cached file.
See Caching strategies in esp_set_cache_dir() to configure a
persistent cache.
See also
CartoBase ANE boundaries and utilities:
esp_get_capimun(),
esp_get_countries_siane(),
esp_get_munic_siane(),
esp_get_prov_siane(),
esp_get_spain_siane(),
esp_siane_bulk_download()
Examples
ccaas1 <- esp_get_ccaa_siane()
utils::head(ccaas1)
#> Simple feature collection with 6 features and 21 fields
#> Geometry type: MULTIPOLYGON
#> Dimension: XY
#> Bounding box: xmin: -13.21993 ymin: 34.70165 xmax: 4.327771 ymax: 43.66147
#> Geodetic CRS: ETRS89
#> # A tibble: 6 × 22
#> codauto iso2.ccaa.code nuts1.code nuts2.code ine.ccaa.name iso2.ccaa.name.es
#> <chr> <chr> <chr> <chr> <chr> <chr>
#> 1 01 ES-AN ES6 ES61 Andalucía Andalucía
#> 2 02 ES-AR ES2 ES24 Aragón Aragón
#> 3 03 ES-AS ES1 ES12 Asturias, Prin… Asturias, Princi…
#> 4 04 ES-IB ES5 ES53 Balears, Illes Islas Baleares
#> 5 05 ES-CN ES7 ES70 Canarias Canarias
#> 6 06 ES-CB ES1 ES13 Cantabria Cantabria
#> # ℹ 16 more variables: iso2.ccaa.name.ca <chr>, iso2.ccaa.name.gl <chr>,
#> # iso2.ccaa.name.eu <chr>, nuts2.name <chr>, cldr.ccaa.name.en <chr>,
#> # cldr.ccaa.name.es <chr>, cldr.ccaa.name.ca <chr>, cldr.ccaa.name.ga <chr>,
#> # cldr.ccaa.name.eu <chr>, ccaa.shortname.en <chr>, ccaa.shortname.es <chr>,
#> # ccaa.shortname.ca <chr>, ccaa.shortname.ga <chr>, ccaa.shortname.eu <chr>,
#> # nuts1.name <chr>, geometry <MULTIPOLYGON [°]>
# Low resolution.
ccaas_low <- esp_get_ccaa_siane(
rawcols = TRUE, moveCAN = FALSE,
resolution = 10, epsg = 3035
)
library(ggplot2)
ggplot(ccaas_low) +
geom_sf(aes(fill = nuts1.name)) +
scale_fill_viridis_d(option = "cividis")