Increase the api limit in ggmap's geocode function (in R)

L P picture L P · Dec 21, 2015 · Viewed 10k times · Source

I'm trying to use the geocode function from the ggmaps library in R to get coordinates for specific locations. I'm able to use the function fine so far.

The issue I'm running into is that I would like to increase my daily limit from 2,500 to 100,000. The official Google documentation says that this is readily possible if you enable billing on the project, which I'm happy to do. When you proceed with this process, the Google Developers Console gives you a personalized API key.

However, the geocode function doesn't have an option to put in this personalized API key. Instead, it asks for the client (client ID for business users) and signature(signature for business users), which is how Google Maps API for Work customers can access the API. I get that this is also an option, but that seems to be a very use case, since Google Maps API for Work seems to be designed for large enterprise accounts:

Daily quota starting at 100,000 requests per 24 hours, based on annual contractual purchase.

So my question boils down to this: can I use the geocode function from the ggmapslibrary in R to ping the Google Maps Geocoding API?

Answer

SymbolixAU picture SymbolixAU · Jun 25, 2016

I've written the package googleway to access google maps API where you can specify your api key.

For example

library(googleway)

key <- "your_api_key"

google_geocode(address = "San Francisco",
               key = key)

# $results
# address_components
# 1 San Francisco, San Francisco County, California, United States, SF, San Francisco County, CA, US, locality, political, administrative_area_level_2, political, administrative_area_level_1, political, country, political
# formatted_address geometry.bounds.northeast.lat geometry.bounds.northeast.lng geometry.bounds.southwest.lat
# 1 San Francisco, CA, USA                      37.92977                     -122.3279                      37.69313
# geometry.bounds.southwest.lng geometry.location.lat geometry.location.lng geometry.location_type
# 1                     -123.1661              37.77493             -122.4194            APPROXIMATE
# geometry.viewport.northeast.lat geometry.viewport.northeast.lng geometry.viewport.southwest.lat
# 1                          37.812                       -122.3482                         37.7034
# geometry.viewport.southwest.lng                    place_id               types
# 1                        -122.527 ChIJIQBpAG2ahYAR_6128GcTUEo locality, political
# 
# $status
# [1] "OK"