Uses the Nominatim API https://nominatim.org/release-docs/develop/api/Search/ to retrieve the Code officiel geographique (COG) and the Code postal of a French town.
get_city_admin_info(city, county = NULL, state = NULL, limit = 1L)
a character
of length 1.
(optional) a character
of length 1. The county (departement)
of the city used to refine the query.
(optional) a character
of length 1. The state (region)
of the city used to refine the query.
an integer
of length 1. The number of results to return.
Default is 1
.
A data.frame
with the following variables:
input
: the value of the argument city
village
: the name of the city
in Open Street Map database
city
: the name of the city
in Open Street Map database
town
: the name of the city
in Open Street Map database
municipality
: the name of the city
in Open Street Map database
county
: the name of the French departement
state
: the name of the French region
region
: the name of the region of France
country
: the name of the region of France
postcode
: the Code postal
code_insee
: the Code officiel geographique
longitude
: the longitude of the administrative center of the city
latitude
: the latitude of the administrative center of the city
get_city_admin_info(city = "Florac")
#> input village city town municipality county state
#> 1 Florac Florac Trois Rivières NA NA Florac Lozère Occitanie
#> region country postcode code_insee longitude latitude
#> 1 France métropolitaine France 48400 48061 3.578021 44.31901
get_city_admin_info(city = "La Salle-Prunet")
#> input village city town municipality county state
#> 1 La Salle-Prunet Florac Trois Rivières NA NA Florac Lozère Occitanie
#> region country postcode code_insee longitude latitude
#> 1 France métropolitaine France 48400 48186 3.646907 44.31643
get_city_admin_info(city = "Florac-Trois-Rivieres")
#> input village city town municipality county
#> 1 Florac-Trois-Rivieres Florac Trois Rivières NA NA Florac Lozère
#> state region country postcode code_insee longitude
#> 1 Occitanie France métropolitaine France 48400 48061 3.594027
#> latitude
#> 1 44.32382