Skip to contents


Deprecated: use oc_reverse or oc_reverse_df for reverse geocoding.


  key = opencage_key(),
  bounds = NULL,
  countrycode = NULL,
  language = NULL,
  limit = 10,
  min_confidence = NULL,
  no_annotations = FALSE,
  no_dedupe = FALSE,
  no_record = FALSE,
  abbrv = FALSE,
  add_request = TRUE


latitude, longitude

Numeric vectors of latitude and longitude values.


Your OpenCage API key as a character vector of length one. By default, opencage_key() will attempt to retrieve the key from the environment variable OPENCAGE_KEY.


Bounding box, ignored for reverse geocoding.


Country code, ignored for reverse geocoding.


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 language parameter is set to NULL (which is the default), the tag is not recognized, or OpenCage does not have a record in that language, the results will be returned in English.


How many results should be returned (1-100), ignored for reverse geocoding.


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 NULL.


Logical vector indicating whether additional information about the result location should be returned. TRUE by default, which means that the results will not contain annotations.


Logical vector (default FALSE), when TRUE the results will not be deduplicated.


Logical vector of length one (default FALSE), when TRUE no log entry of the query is created, and the geocoding request is not cached by OpenCage.


Logical vector (default FALSE), when TRUE addresses in the formatted field of the results are abbreviated (e.g. "Main St." instead of "Main Street").


Logical vector (default FALSE) indicating whether the request is returned again with the results. If the return value is a df_list, the query text is added as a column to the results. json_list results will contain all request parameters, including the API key used! This is currently ignored by OpenCage if return value is geojson_list.


A list with

  • results as a tibble with one line per result,

  • the number of results as an integer,

  • the timestamp as a POSIXct object,

  • rate_info tibble/data.frame with the maximal number of API calls per day for the used key, the number of remaining calls for the day and the time at which the number of remaining calls will be reset.


if (FALSE) { # oc_key_present() && oc_api_ok()

  latitude = 0, longitude = 0,
  limit = 2