geocode | R Documentation |
Call the Open-Meteo Geocoding API to retrieve co-ordinates and other information for a given place name. The closest n matching records can be requested.
Geocoding API documentation is available at: https://open-meteo.com/en/docs/geocoding-api.
geocode(location_name, n_results = 1, language = "en", silent = TRUE)
location_name |
Required. The location name to search for via fuzzy matching. |
n_results |
The number of matching locations provided in response, sorted by relevance (default 1, up to 100). |
language |
Desired response language for place names (lower-cased two-letter string, i.e. "en" for London,"fr" for Londres). |
silent |
If |
Details for each matching location (latitude, longitude, elevation, population, timezone, and administrative areas)
# obtain co-ordinates of Sydney
gc <- geocode("Sydney")
sydney_coords <- c(gc$latitude, gc$longitude)
sydney_coords
# elevation of Kathmandu
geocode("kathmandu")$elevation
# 10 places named 'Paris'
geocode("paris", 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.