Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rate limit error on geocode() only when source is google #156

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ FIXES
* README images moved from figures/ to tools/
* mutate_geocode() now works with tibbles (#68, thanks dannguyen)
* get_stamenmap() now properly changes colors to black and white.
* geocode() throws rate limit errors only when source is google (#150,
thanks @royalts)


ggmap 2.6.1
Expand Down
6 changes: 4 additions & 2 deletions R/geocode.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ geocode <- function(location, output = c("latlon", "latlona", "more", "all"),
}

# message/stop as neeeded
s <- sprintf("google restricts requests to %s requests a day for non-premium use.", limit)
if(length(location) > as.numeric(limit)) stop(s, call. = FALSE)
if(source == 'google') {
s <- sprintf("google restricts requests to %s requests a day for non-premium use.", limit)
if(length(location) > as.numeric(limit)) stop(s, call. = FALSE)
}
if(length(location) > 200 && messaging) message(paste("Reminder", s, sep = " : "))

# geocode ply and out
Expand Down