Skip to contents

Returns Comarcas of Spain. Comarcas are traditional informal territorial division, comprising several municipalities sharing geographical, economic or cultural traits, typically with not well 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
)

Source

INE: PC_Axis files, IGN, Ministry of Agriculture, Fisheries and Food (MAPA).

Arguments

region

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

comarca

character string. A name or regex expression with the names of the required comarcas. NULL will return all the possible comarcas.

moveCAN

A logical TRUE/FALSE or a vector of coordinates c(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 in esp_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:

update_cache

logical. Should the cached file be refreshed? Default is FALSE. When set to TRUE, it will force a new download.

cache_dir

character string. A path to a cache directory. See Caching strategies section in esp_set_cache_dir().

verbose

logical. If TRUE displays 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 NUTS1), all the comarcas of that level will be 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) does not always have a formal legal status. They correspond mainly to natural areas (valleys, river basins, etc.) or even to 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), in 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 one provided under different classification criteria.

  • "INE": Comarcas as defined by the National Statistics Institute (INE).

  • "IGN": Official comarcas, only available on some Autonomous Communities, 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).

Note

Please check the download and usage provisions on gisco_attributions().

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")

# }