Get comarcas of Spain. Comarcas are traditional informal territorial divisions comprising several municipalities that share geographical, economic or cultural traits, typically with poorly defined limits.
Usage
esp_get_comarca(
region = NULL,
comarca = NULL,
moveCAN = TRUE,
type = c("INE", "IGN", "AGR", "LIV"),
epsg = 4258,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE
)Arguments
- region
Character string. A vector of names, codes or both for provinces, or
NULLto get all the comarcas. See Details.- comarca
Character string. A name or
regexexpression with the names of the required comarcas. UseNULLto return all possible comarcas.- 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().- type
Character string. One of
"INE","IGN","AGR","LIV". Type of comarca to return. See Details.- 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.
- 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 strategies section in
esp_set_cache_dir().- verbose
logical. If
TRUEdisplays informational messages.
Value
A sf 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" (see esp_codelist).
When calling a higher level (province, Autonomous Community or City, or NUTS 1), all comarcas of that level are added.
Note
The use of the information contained on the INE website may be carried out by users or re-use agents, at their own risk, and they will be the sole liable parties in the case of having to answer to third parties due to damages arising from such use.
About comarcas
Comarcas (English equivalent: district, county, area or zone) do not always have a formal legal status. They correspond mainly to natural areas (valleys, river basins and similar areas), historical regions or ancient kingdoms.
In the case of Spain, comarcas only have an administrative character legally recognized in Catalonia, the Basque Country, Navarra (named merindades instead), the region of El Bierzo (Castilla y Leon) and Aragon. Galicia, the Principality of Asturias and Andalusia have functional comarcas.
Types
esp_get_comarca() can retrieve several types of comarcas, each provided
under different classification criteria.
"INE": Comarcas defined by the National Statistics Institute (INE)."IGN": Official comarcas, only available for some Autonomous Communities and Cities, provided by the National Geographic Institute."AGR": Agrarian comarcas defined by the Ministry of Agriculture, Fisheries and Food (MAPA)."LIV": Livestock comarcas defined by the Ministry of Agriculture, Fisheries and Food (MAPA).
See also
Political and administrative boundary datasets:
esp_get_capimun(),
esp_get_ccaa(),
esp_get_ccaa_siane(),
esp_get_countries_siane(),
esp_get_gridmap,
esp_get_munic(),
esp_get_munic_siane(),
esp_get_nuts(),
esp_get_prov(),
esp_get_prov_siane(),
esp_get_simpl,
esp_get_spain(),
esp_get_spain_siane(),
esp_siane_bulk_download()
Examples
# \donttest{
comarcas <- esp_get_comarca(moveCAN = FALSE)
library(ggplot2)
ggplot(comarcas) +
geom_sf()
# IGN provides recognized comarcas.
rec <- esp_get_comarca(type = "IGN")
ggplot(rec) +
geom_sf(aes(fill = t_comarca))
# Legal comarcas of Catalunya.
comarcas_cat <- esp_get_comarca("Catalunya", type = "IGN")
ggplot(comarcas_cat) +
geom_sf(aes(fill = ine.prov.name)) +
labs(fill = "Province")
# }
