knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
{nutscoder} provides the function nuts_geocode
, which attempts to find NUTS region codes for location names by using Nominatim to search OpenStreetMap (OSM) data.
You can install the development version of {nutscoder} like so:
remotes::install_github("RegioHub/nutscoder")
library(nutscoder) nuts_geocode(c("Hamburgo", "هامبورغ", "HH", "Berlin", "🐻Bärlin", "ベルリン", "North Rhine-Westphalia", "nrw"))
The sf geometry of the geocoded NUTS regions can be returned:
nuts_geocode(c("berlin", "brandenburg"), return_geometry = TRUE) |> sf::st_geometry() |> plot()
The argument nominatim_api
can be used to specify the API URL of the Nominatim instance used to search for OSM data. By default, nuts_geocode()
uses the public Nominatim instance (nominatim_api = "https://nominatim.openstreetmap.org"
), which has an absolute maximum of 1 request per second and is not suitable for intensive use. You can install your own instance of Nominatim to avoid the limitations of the public instance.
print(citation("nutscoder"), bibtex = FALSE)
A BibTeX entry for LaTeX users is
toBibtex(citation("nutscoder"))
The use of the server running at https://nominatim.openstreetmap.org is governed by the Nominatim Usage Policy.
Geodata from OpenStreetMap are licensed under the terms of the Open Database License (ODbL) 1.0.
Use of any OSMF provided service is further governed by the OSMF Terms of Use.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.