View source: R/gisco_get_nuts.R
gisco_get_nuts | R Documentation |
sf
polygons, points and linesReturns NUTS regions polygons, lines and points at a specified scale, as provided by GISCO.
NUTS are provided at three different levels:
"0"
: Country level
"1"
: Groups of states/regions
"2"
: States/regions
"3"
: Counties/provinces/districts
Note that NUTS-level definition may vary across countries. See also https://ec.europa.eu/eurostat/web/gisco/geodata//statistical-units/territorial-units-statistics.
gisco_get_nuts(
year = "2016",
epsg = "4326",
cache = TRUE,
update_cache = FALSE,
cache_dir = NULL,
verbose = FALSE,
resolution = "20",
spatialtype = "RG",
country = NULL,
nuts_id = NULL,
nuts_level = "all"
)
year |
Release year of the file. One
of |
epsg |
projection of the map: 4-digit EPSG code. One of:
|
cache |
A logical whether to do caching. Default is |
update_cache |
A logical whether to update cache. Default is |
cache_dir |
A path to a cache directory. See About caching. |
verbose |
Logical, displays information. Useful for debugging,
default is |
resolution |
Resolution of the geospatial data. One of
|
spatialtype |
Type of geometry to be returned:
Note that parameters |
country |
Optional. A character vector of country codes. It could be
either a vector of country names, a vector of ISO3 country codes or a
vector of Eurostat country codes. Mixed types (as |
nuts_id |
Optional. A character vector of NUTS IDs. |
nuts_level |
NUTS level. One of |
A sf
object specified by spatialtype
. The resulting
sf
object would present an additional column geo
(equal to
NUTS_ID
) for improving compatibility with eurostat package. See
eurostat::get_eurostat_geospatial()
).
See also gisco_nuts to understand the columns and values provided.
You can set your cache_dir
with gisco_set_cache_dir()
.
Sometimes cached files may be corrupt. On that case, try re-downloading
the data setting update_cache = TRUE
.
If you experience any problem on download, try to download the
corresponding .geojson
file by any other method and save it on your
cache_dir
. Use the option verbose = TRUE
for debugging the API query.
For a complete list of files available check gisco_db.
https://gisco-services.ec.europa.eu/distribution/v2/
gisco_nuts, gisco_get_countries()
,
eurostat::get_eurostat_geospatial()
Other political:
gisco_bulk_download()
,
gisco_get_coastallines()
,
gisco_get_countries()
,
gisco_get_lau()
,
gisco_get_postalcodes()
,
gisco_get_units()
,
gisco_get_urban_audit()
nuts2 <- gisco_get_nuts(nuts_level = 2)
library(ggplot2)
ggplot(nuts2) +
geom_sf() +
# ETRS89 / ETRS-LAEA
coord_sf(
crs = 3035, xlim = c(2377294, 7453440),
ylim = c(1313597, 5628510)
) +
labs(title = "NUTS-2 levels")
# NUTS-3 for Germany
germany_nuts3 <- gisco_get_nuts(nuts_level = 3, country = "Germany")
ggplot(germany_nuts3) +
geom_sf() +
labs(
title = "NUTS-3 levels",
subtitle = "Germany",
caption = gisco_attributions()
)
# Select specific regions
select_nuts <- gisco_get_nuts(nuts_id = c("ES2", "FRJ", "FRL", "ITC"))
ggplot(select_nuts) +
geom_sf(aes(fill = CNTR_CODE)) +
scale_fill_viridis_d()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.