Description Usage Arguments Value Examples
View source: R/geoCode_mapbox.R
The function geocodes a single address given as a character string. Be as specific as possible, including the country or postcode to avoid ambiguity. To avoid loss of accuracy when geocoding a lat/lng string, the geoCode function does not geocode lat/lng strings but instead returns the same string as a dataframe.
1 2 3 4 5 | geocode_mapbox(
address,
api_key = Sys.getenv("mapbox_api_key"),
return_all = TRUE
)
|
address |
character string with address to be geocoded. Be as specific as possible to avoid ambiguity. |
api_key |
character string containing api key for the google maps geocode api. You can generate one for free in your google cloud console. |
return_all |
logical value. Some locations may return more than one geocoded result. If you only want one row returned set return_all = FALSE. |
a data.frame containing the coordinates, location type and approximate address.
1 2 3 4 | geocode_mapbox('London Bridge, London, UK', return_all = FALSE)
# lat lng type address
# 51.50788 -0.0877321 GEOMETRIC_CENTER London Bridge, London SE1 9RA, UK
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.