View source: R/esp-get-comarca.R
| esp_get_comarca | R Documentation |
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.
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
)
region |
Character string. A vector of names, codes or both for
provinces, or |
comarca |
Character string. A name or |
moveCAN |
A logical |
type |
Character string. One of |
epsg |
Character string or number. Projection of the map: 4-digit EPSG code. One of:
|
update_cache |
Logical. If |
cache_dir |
Character string. A path to a cache directory. See Caching. |
verbose |
A logical value indicating whether to display informational messages. |
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, such as a province, Autonomous Community, Autonomous City or NUTS 1 region, all comarcas of that level are added.
A sf object.
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 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.
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).
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.
The use of the information contained on the INE website is at the sole risk of users and re-use agents. They are liable for damages to third parties arising from such use.
INE: PC_Axis files, IGN, Ministry of Agriculture, Fisheries and Food (MAPA).
Additional boundary datasets and representations:
esp_get_gridmap,
esp_get_simpl
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.