This function is deprecated. Use:
gisco_get_metadata()(equivalent tomode = "df")TODO
Download individual shapefiles of units. Unlike gisco_get_countries(),
gisco_get_nuts() or gisco_get_urban_audit(), that downloads a full
dataset and applies filters, gisco_get_units() downloads a single
shapefile for each unit.
Arguments
- id_giscoR
Select the
unittype to be downloaded. Accepted values are"nuts","countries"or"urban_audit".- unit
Unit ID to be downloaded. See Details.
- mode
Controls the output of the function. Possible values are
"sf"or"df". See Value and Details.- year
character string or number. Release year of the file. One of
"2024","2020","2016","2013","2010","2006","2001".- epsg
character string or number. Projection of the map: 4-digit EPSG code. One of:
"4326": WGS84"3035": ETRS89 / ETRS-LAEA"3857": Pseudo-Mercator
- cache
logical. Whether to do caching. Default is
TRUE. See Caching strategies section ingisco_set_cache_dir().- update_cache
logical. Should the cached file be refreshed?. Default is
FALSE. When set toTRUEit would force a new download.- cache_dir
character string. A path to a cache directory. See Caching strategies section in
gisco_set_cache_dir().- verbose
logical. If
TRUEdisplays informational messages.- resolution
character string or number. Resolution of the geospatial data. One of:
"60": 1:60million"20": 1:20million"10": 1:10million"03": 1:3million"01": 1:1million
- spatialtype
Type of geometry to be returned:
"RG", forPOLYGONand"LB"forPOINT.
Value
A sf object on mode = "sf" or a data frame on mode = "df".
Details
The function can return a data frame on mode = "df" or a sf
object on mode = "sf".
In order to see the available unit ids with the required
combination of spatialtype, year, first run the function on "df"
mode. Once that you get the data frame you can select the required ids
on the unit parameter.
On mode = "df" the only relevant parameters are spatialtype, year.
Note
Country-level files would be renamed on your cache_dir
to avoid naming conflicts with NUTS-0 datasets.
Please check the download and usage provisions on gisco_attributions().
See also
Other political:
gisco_bulk_download(),
gisco_get_urban_audit()
Author
dieghernan, https://github.com/dieghernan/
Examples
# \donttest{
cities <- gisco_get_units(
id_giscoR = "urban_audit",
mode = "df",
year = "2020"
)
#> Warning: `gisco_get_units()` was deprecated in giscoR 1.0.0.
#> ℹ Please use `gisco_get_metadata()` instead.
VAL <- cities[grep("Valencia", cities$URAU_NAME), ]
# Order from big to small
VAL <- VAL[order(as.double(VAL$AREA_SQM), decreasing = TRUE), ]
VAL.sf <- gisco_get_units(
id_giscoR = "urban_audit",
year = "2020",
unit = VAL$URAU_CODE
)
# Provincia
Provincia <-
gisco_get_units(
id_giscoR = "nuts",
unit = c("ES523"),
resolution = "01"
)
# Reorder
VAL.sf$URAU_CATG <- factor(VAL.sf$URAU_CATG, levels = c("F", "K", "C"))
# Plot
library(ggplot2)
ggplot(Provincia) +
geom_sf(fill = "gray1") +
geom_sf(data = VAL.sf, aes(fill = URAU_CATG)) +
scale_fill_viridis_d() +
labs(
title = "Valencia",
subtitle = "Urban Audit",
fill = "Urban Audit\ncategory"
)
# }
