geocode | R Documentation |
Uses the location_word
and Country
columns of the data frame to make queries
to the geonames API and geocode the locations in the dataset.
Note:
The Geonames API (for free accounts) limits you to 1000 queries an hour
You need a geonames username to make queries. You can learn more about that here
geocode(., n_results = 1, unwrap = FALSE, geonames_username)
. |
a data frame which has been locationized (see |
n_results |
number of lat/longs to get |
unwrap |
if true, returns lat1, lat2, lng1, lng2 etc. as different columns, otherwise one lat column and 1 lng column |
geonames_username |
Username for geonames API. More about getting one is in the note above. |
the same data frame with a lat column/columns and lng column/columns
df <- tibble::tribble(
~value, ~location_word, ~Country,
"mumbai region, district of seattle, sichuan province", "mumbai","India",
"mumbai region, district of seattle, sichuan province", "seattle", "USA"
)
geocode(df, n_results = 1, unwrap = TRUE, geonames_username = "rammkripa")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.