| Title: | Historical Municipal Boundaries of Spain (1900-2001) |
|---|---|
| Description: | Municipal boundaries of Spain for each population census between 1900 and 2001, together with provinces, judicial districts and electoral districts (Cortes of the Restoration in 1920 and constituencies of the Second Republic in 1931, 1933 and 1936) built from them, and the census figures of every municipality from 1842 to 2011. All maps derive from a single partition of the territory, so they have no gaps or overlaps and can be aggregated consistently. Boundaries of historical municipalities are an approximate reconstruction. Geometries are downloaded from 'Zenodo' <doi:10.5281/zenodo.23663208> and cached locally. |
| Authors: | Pau Vall Prat [aut, cre, cph] (ORCID: <https://orcid.org/0000-0003-1418-7833>) |
| Maintainer: | Pau Vall Prat <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 0.1.0 |
| Built: | 2026-11-11 23:58:04 UTC |
| Source: | https://github.com/cran/mapSpainHist |
Population census data for every municipality and census edition, from
Municipis_Espanya_1842-2011.xlsx. A municipality is in force at a census when
hogares is not missing. Rows with no_munic == 1 are the non-municipal
territories (codes 53xxx) present in the maps, which have no census figures.
censoscensos
A data frame with columns:
INE municipality code (5 characters; 6 for municipalities extinct before 1900).
Census year.
Municipality name.
Province.
Autonomous community code and name.
Judicial district (partido judicial).
Households.
De jure population.
De facto population.
Continuous population series.
1 for non-municipal territories (53xxx), 0 otherwise.
Electoral districts built by dissolving the municipalities of the census:
1920: districts for the Cortes of the Restoration, on the 1920
municipalities (Melilla has no district and is not included).
1931, 1933, 1936: constituencies (circunscripciones) of the
Second Republic, on the 1930 municipalities.
cod_unit has 4 digits: the province code and the district number
(alphabetical order within the province). Non-municipal territories (53xxx) are
assigned to the district of their province with which they share the longest
boundary.
esp_get_circ_hist( year, epsg = 4258, moveCAN = FALSE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )esp_get_circ_hist( year, epsg = 4258, moveCAN = FALSE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )
year |
1920, 1931, 1933 or 1936. Census figures come from the 1920 census (1920) or the 1930 census (1931-1936). |
epsg |
EPSG code of the output (default 4258, ETRS89, as in mapSpain). |
moveCAN |
Position of the Canary Islands. |
census_data |
If |
cache_dir |
Cache directory. If |
update_cache |
If |
verbose |
If |
An sf object with columns cod_unit, nom, n_mun and, optionally,
the census figures.
c1933 <- esp_get_circ_hist(1933, cache_dir = tempdir())c1933 <- esp_get_circ_hist(1933, cache_dir = tempdir())
Returns the municipalities in force at the given census. All census maps come from the same partition of the territory, so they have no gaps or overlaps and can be aggregated (provinces, judicial districts, electoral districts...) without slivers.
esp_get_munic_hist( year, epsg = 4258, moveCAN = FALSE, include_nonmunicipal = TRUE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )esp_get_munic_hist( year, epsg = 4258, moveCAN = FALSE, include_nonmunicipal = TRUE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )
year |
Census year, one of |
epsg |
EPSG code of the output (default 4258, ETRS89, as in mapSpain). |
moveCAN |
Position of the Canary Islands. |
include_nonmunicipal |
If |
census_data |
If |
cache_dir |
Cache directory. If |
update_cache |
If |
verbose |
If |
The geometries are downloaded from Zenodo the first time and stored in a cache
directory (see mhist_cache_dir()).
An sf object with one row per municipality, or NULL (with a
message) if the geometries cannot be downloaded.
the boundaries of most historical municipalities are an approximate reconstruction. See mapSpainHist-package.
m1930 <- esp_get_munic_hist(1930, cache_dir = tempdir()) m1930_can <- esp_get_munic_hist(1930, moveCAN = TRUE, cache_dir = tempdir()) if (!is.null(m1930)) plot(sf::st_geometry(m1930)) if (!is.null(m1930_can) && requireNamespace("mapSpain", quietly = TRUE)) { plot(sf::st_geometry(m1930_can)) plot(sf::st_geometry(mapSpain::esp_get_can_box()), add = TRUE) }m1930 <- esp_get_munic_hist(1930, cache_dir = tempdir()) m1930_can <- esp_get_munic_hist(1930, moveCAN = TRUE, cache_dir = tempdir()) if (!is.null(m1930)) plot(sf::st_geometry(m1930)) if (!is.null(m1930_can) && requireNamespace("mapSpain", quietly = TRUE)) { plot(sf::st_geometry(m1930_can)) plot(sf::st_geometry(mapSpain::esp_get_can_box()), add = TRUE) }
Judicial districts for the censuses of 1900, 1910, 1920 and 1930, built by
dissolving the municipalities of each census. cod_unit has 4 digits: the
province code and the district number (alphabetical order within the province,
the same in all censuses). Non-municipal territories (53xxx) are assigned to the
district of their province with which they share the longest boundary.
esp_get_pj_hist( year, epsg = 4258, moveCAN = FALSE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )esp_get_pj_hist( year, epsg = 4258, moveCAN = FALSE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )
year |
Census year: 1900, 1910, 1920 or 1930. |
epsg |
EPSG code of the output (default 4258, ETRS89, as in mapSpain). |
moveCAN |
Position of the Canary Islands. |
census_data |
If |
cache_dir |
Cache directory. If |
update_cache |
If |
verbose |
If |
An sf object with columns cod_unit, nom, n_mun and, optionally,
the census figures.
pj1910 <- esp_get_pj_hist(1910, cache_dir = tempdir())pj1910 <- esp_get_pj_hist(1910, cache_dir = tempdir())
Provinces built by dissolving the municipalities of the census, so they nest
exactly with esp_get_munic_hist(). Non-municipal territories (53xxx) are
assigned to the province that contains them.
esp_get_prov_hist( year, epsg = 4258, moveCAN = FALSE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )esp_get_prov_hist( year, epsg = 4258, moveCAN = FALSE, census_data = TRUE, cache_dir = NULL, update_cache = FALSE, verbose = FALSE )
year |
Census year, one of |
epsg |
EPSG code of the output (default 4258, ETRS89, as in mapSpain). |
moveCAN |
Position of the Canary Islands. |
census_data |
If |
cache_dir |
Cache directory. If |
update_cache |
If |
verbose |
If |
An sf object with columns cod_unit (2-digit INE province code),
nom, n_mun and, optionally, the census figures; NULL (with a message)
if the geometries cannot be downloaded.
p1930 <- esp_get_prov_hist(1930, cache_dir = tempdir())p1930 <- esp_get_prov_hist(1930, cache_dir = tempdir())
The geometries are downloaded from Zenodo the first time they are needed and
stored in a cache directory. By default it is the user cache directory given by
tools::R_user_dir(). It can be changed for the session with
mhist_set_cache_dir() or with the cache_dir argument of the esp_get_*_hist()
functions.
mhist_cache_dir(cache_dir = NULL) mhist_set_cache_dir(cache_dir)mhist_cache_dir(cache_dir = NULL) mhist_set_cache_dir(cache_dir)
cache_dir |
Path of the cache directory. If |
The path of the cache directory (invisibly for mhist_set_cache_dir()).
mhist_cache_dir() old <- mhist_set_cache_dir(tempdir()) options(mapSpainHist.cache_dir = NULL)mhist_cache_dir() old <- mhist_set_cache_dir(tempdir()) options(mapSpainHist.cache_dir = NULL)
Census editions available
mhist_census_years()mhist_census_years()
Integer vector with the census years covered by the package.
mhist_census_years()mhist_census_years()
Deletes the downloaded geometries, which will be downloaded again the next time they are needed.
mhist_clear_cache(cache_dir = NULL)mhist_clear_cache(cache_dir = NULL)
cache_dir |
Path of the cache directory. If |
TRUE invisibly if a file was deleted, FALSE otherwise.
mhist_clear_cache(tempdir())mhist_clear_cache(tempdir())
Correspondence between municipalities (cod_ine) and the units returned by
esp_get_prov_hist(), esp_get_pj_hist() and esp_get_circ_hist(). Useful to
aggregate municipal data. Non-municipal territories (53xxx) are included with
the unit they were assigned to.
unitatsunitats
A data frame with columns:
"prov", "pj" (judicial district) or "circ" (electoral district).
Census year (prov, pj) or election year (circ: 1920, 1931, 1933, 1936).
INE municipality code.
Unit code (2 digits for provinces, 4 digits otherwise).