The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.
The geonuts package provides simple tools to identify European NUTS regions (Nomenclature of Territorial Units for Statistics) based on geographic coordinates, and to visualise the results on a map. It builds on Eurostat’s geospatial layers via eurostat and giscoR.
library(geonuts)
# Example coordinates for European capitals
lat <- c(52.5200, 48.8566, 41.9028)
lon <- c(13.4050, 2.3522, 12.4964)
# Identify NUTS regions (all levels)
nuts_all <- get_nuts(
latitude = lat,
longitude = lon,
level = "all",
year = 2021,
resolution = 20,
verbose = FALSE
)
nuts_all
#> lat lon nuts0 nuts1 nuts2 nuts3 cntr_code match_status match_dist_km
#> 1 52.5200 13.4050 DE DE3 DE30 DE300 DE matched NA
#> 2 48.8566 2.3522 FR FR1 FR10 FR101 FR matched NA
#> 3 41.9028 12.4964 IT <NA> <NA> <NA> IT unmatched NA
#> year resolution
#> 1 2021 20
#> 2 2021 20
#> 3 2021 20# Create a map for the most granular (NUTS3) level
map_nuts(nuts_all, map_level = 3, show_points = TRUE)
#> [geonuts] Using cached NUTS layer.
#> [geonuts] Rendered map: level=3, year=2021, resolution=20.You can also filter the map to a single country:
map_nuts(nuts_all, map_level = 3, country = "IT")
#> [geonuts] Using cached NUTS layer.
#> [geonuts] Rendered map: level=3, year=2021, resolution=20, country=IT.If you only need one level (e.g., NUTS2):
nuts2 <- get_nuts(lat, lon, level = 2, year = 2021, resolution = 20)
#> [geonuts] Using cached NUTS layer.
#> [geonuts] Matched level 2.
head(nuts2)
#> lat lon nuts cntr_code match_status match_dist_km level year
#> 1 52.5200 13.4050 DE30 DE matched NA 2 2021
#> 2 48.8566 2.3522 FR10 FR matched NA 2 2021
#> 3 41.9028 12.4964 <NA> <NA> unmatched NA 2 2021
#> resolution
#> 1 20
#> 2 20
#> 3 20Eurostat layers are cached automatically by eurostat and
giscoR, so once downloaded, subsequent calls to
get_nuts() and map_nuts() are offline-safe and
much faster.
To clear cached shapefiles manually:
| Function | Purpose |
|---|---|
get_nuts() |
Identify NUTS regions from latitude–longitude pairs |
map_nuts() |
Visualise NUTS regions and matched points on a map |
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.