oc_reverse {opencage} | R Documentation |
Reverse geocoding
Description
Reverse geocoding from numeric vectors of latitude and longitude pairs to the names and addresses of a location.
Usage
oc_reverse(
latitude,
longitude,
return = c("df_list", "json_list", "geojson_list", "url_only"),
language = NULL,
min_confidence = NULL,
no_annotations = TRUE,
roadinfo = FALSE,
no_dedupe = FALSE,
abbrv = FALSE,
add_request = FALSE,
...
)
Arguments
latitude , longitude |
Numeric vectors of latitude and longitude values. |
return |
A character vector of length one indicating the return value of
the function, either a list of tibbles ( |
language |
An IETF BCP 47 language tag (such as "es" for
Spanish or "pt-BR" for Brazilian Portuguese). OpenCage will attempt to
return results in that language. Alternatively you can specify the "native"
tag, in which case OpenCage will attempt to return the response in the
"official" language(s). In case the |
min_confidence |
Numeric vector of integer values between 0 and 10
indicating the precision of the returned result as defined by its
geographical extent, (i.e. by the extent of the result's bounding box). See
the API documentation for
details. Only results with at least the requested confidence will be
returned. Default is |
no_annotations |
Logical vector indicating whether additional
information about the result location should be returned. |
roadinfo |
Logical vector indicating whether the geocoder should attempt
to match the nearest road (rather than an address) and provide additional
road and driving information. Default is |
no_dedupe |
Logical vector (default |
abbrv |
Logical vector (default |
add_request |
Logical vector (default |
... |
Ignored. |
Value
Depending on the return
argument, oc_reverse
returns a list with
either
the results as tibbles (
"df_list"
, the default),the results as JSON specified as a list (
"json_list"
),the results as GeoJSON specified as a list (
"geojson_list"
), orthe URL of the OpenCage API call for debugging purposes (
"url_only"
).
When the results are returned as (a list of) tibbles, the column names
coming from the OpenCage API are prefixed with "oc_"
.
See Also
oc_reverse_df()
for inputs as a data frame, or oc_forward()
and
oc_forward()
for forward geocoding. For more information about the API
and the various parameters, see the OpenCage API documentation.
Examples
# Reverse geocode a single location
oc_reverse(latitude = -36.85007, longitude = 174.7706)
# Reverse geocode multiple locations
lat <- c(47.21864, 53.55034, 34.05369)
lng <- c(-1.554136, 10.000654, -118.242767)
oc_reverse(latitude = lat, longitude = lng)
# Return results in a preferred language if possible
oc_reverse(latitude = lat, longitude = lng,
language = "fr")
# Return results as a json list
oc_reverse(latitude = lat, longitude = lng,
return = "json_list")