Description Usage Arguments Details
View source: R/opencage_geocoding.R
This is just a thin wrapper around the opencage::opencage_forward function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
placename |
Placename. |
keyfile |
File (full path) to read key from. |
bounds |
Provides the geocoder with a hint to the region that the query resides in. This value will restrict the possible results to the supplied region. The bounds parameter should be specified as 4 coordinate points forming the south-west and north-east corners of a bounding box. For example, |
countrycode |
Restricts the results to the given country. The country code is a two letter code as defined by the ISO 3166-1 Alpha 2 standard. E.g. "GB" for the United Kingdom, "FR" for France, "US" for United States. |
language |
An IETF format language code (such as "es" for Spanish or "pt-BR" for Brazilian Portuguese). If no language is explicitly specified, we will look for an HTTP Accept-Language header like those sent by a browser and use the first language specified and if none are specified "en" (English) will be assumed. |
limit |
How many results should be returned (1-100). Default is 10. |
min_confidence |
An integer from 1-10. Only results with at least this confidence will be returned. |
no_annotations |
Logical (default FALSE), when TRUE the output will not contain annotations. |
no_dedupe |
Logical (default FALSE), when TRUE the output will not be deduplicated. |
no_record |
Logical (default FALSE), when TRUE no log entry of the query is created at OpenCage. |
abbrv |
Logical (default FALSE), when TRUE addresses are abbreviated (e.g. C. instead of Calle) |
add_request |
Logical (default TRUE), when FALSE the query text is removed from the results data frame. |
To get an API key to access OpenCage geocoding, register at https://geocoder.opencagedata.com/pricing. The free API key provides up to 2,500 calls a day. For ease of use, save your API key as an environment variable as described at https://stat545-ubc.github.io/bit003_api-key-env-var.html.
Both functions of the package will conveniently look for your API key using Sys.getenv("OPENCAGE_KEY")
so if your API key is an environment variable called "OPENCAGE_KEY" you don't need to input it manually.
The underlying data at OpenCage is updated about once a day. Note that the package uses 'memoise' with no timeout argument so that results are cached inside an active R session.
This function typically returns multiple results because of placename ambiguity; consider using the bounds
parameter to limit the area searched.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.