ors_geocode | R Documentation |
Resolve input coordinates to addresses and vice versa.
ors_geocode(
query,
location,
...,
api_key = ors_api_key(),
output = c("parsed", "text", "sf")
)
query |
Name of location, street address or postal code. For a structured geocoding request a named list of parameters. |
location |
Coordinates to be inquired provided in the form |
... |
Optional parameters as described here |
api_key |
Character scalar containing openrouteservice API key |
output |
Output format. By default the response is being parsed to a list-based R object |
This endpoint can be used for geocoding (specified query
) and reverse
geocoding requests (specified location
). Either query
or location
has
to be specified for a valid request. If both parameters are specified
location takes precedence.
Geocoding: a JSON formatted list of objects corresponding to the search input. Reverse geocoding: the next enclosing object with an address tag which surrounds the given coordinate.
Andrzej Oleś andrzej.oles@gmail.com
## locations of Heidelberg around the globe
x <- ors_geocode("Heidelberg")
## set the number of results returned
x <- ors_geocode("Heidelberg", size = 1)
## search within a particular country
ors_geocode("Heidelberg", boundary.country = "DE")
## structured geocoding
x <- ors_geocode(list(locality="Heidelberg", county="Heidelberg"))
## reverse geocoding
location <- x$features[[1L]]$geometry$coordinates
y <- ors_geocode(location = location, layers = "locality", size = 1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.