Get spatial zones for the specified data version. Supports both v1 (2020-2021) and v2 (2022 onwards) data.
spod_get_zones(
zones = c("districts", "dist", "distr", "distritos", "municipalities", "muni",
"municip", "municipios", "lua", "large_urban_areas", "gau", "grandes_areas_urbanas"),
ver = NULL,
data_dir = spod_get_data_dir(),
quiet = FALSE
)
An sf
object (Simple Feature collection).
The columns for v1 (2020-2021) data include:
A character vector containing the unique identifier for each district, assigned by the data provider. This id
matches the id_origin
, id_destination
, and id
in district-level origin-destination and number of trips data.
A string with semicolon-separated identifiers of census districts classified by the Spanish Statistical Office (INE) that are spatially bound within the polygons for each id
.
A string with semicolon-separated municipality identifiers (as assigned by the data provider) corresponding to each district id
.
A string with semicolon-separated municipality identifiers classified by the Spanish Statistical Office (INE) corresponding to each id
.
A string with semicolon-separated district names (from the v2 version of this data) corresponding to each district id
in v1.
A string with semicolon-separated district identifiers (from the v2 version of this data) corresponding to each district id
in v1.
A MULTIPOLYGON
column containing the spatial geometry of each district, stored as an sf object. The geometry is projected in the ETRS89 / UTM zone 30N coordinate reference system (CRS), with XY dimensions.
The columns for v2 (2022 onwards) data include:
A character vector containing the unique identifier for each zone, assigned by the data provider.
A character vector with the name of each district.
A numeric vector representing the population of each district (as of 2022).
A string with semicolon-separated identifiers of census sections corresponding to each district.
A string with semicolon-separated identifiers of census districts as classified by the Spanish Statistical Office (INE) corresponding to each district.
A string with semicolon-separated identifiers of municipalities classified by the Spanish Statistical Office (INE) corresponding to each district.
A string with semicolon-separated identifiers of municipalities, as assigned by the data provider, that correspond to each district.
A string with semicolon-separated identifiers of LUAs (Local Urban Areas) from the provider, associated with each district.
A string with semicolon-separated district identifiers from v1 data corresponding to each district in v2. If no match exists, it is marked as NA
.
A MULTIPOLYGON
column containing the spatial geometry of each district, stored as an sf object. The geometry is projected in the ETRS89 / UTM zone 30N coordinate reference system (CRS), with XY dimensions.
The zones for which to download the data. Can be "districts"
(or "dist"
, "distr"
, or the original Spanish "distritos"
) or "municipalities"
(or "muni"
, "municip"
, or the original Spanish "municipios"
) for both data versions. Additionaly, these can be "large_urban_areas"
(or "lua"
, or the original Spanish "grandes_areas_urbanas"
, or "gau"
) for v2 data (2022 onwards).
Integer. Can be 1 or 2. The version of the data to use. v1 spans 2020-2021, v2 covers 2022 and onwards. See more details in codebooks with spod_codebook()
.
The directory where the data is stored. Defaults to the value returned by spod_get_data_dir()
which returns the value of the environment variable SPANISH_OD_DATA_DIR
or a temporary directory if the variable is not set. To set the data directory, use spod_set_data_dir.
A logical
value indicating whether to suppress messages. Default is FALSE
.
if (FALSE) { # interactive()
# \donttest{
# get polygons for municipalities for the v2 data
municip_v2 <- spod_get_zones(zones = "municipalities", ver = 2)
# get polygons for the districts for the v1 data
distr_v1 <- spod_get_zones(zones = "districts", ver = 1)
# }
}
Run the code above in your browser using DataLab