1

I am using ggmap package in R software in order to geocode a list of addresses. The counting is over 2500 - Googles diary quota for free users. I have been searched about it and I found out that it is possible to geocode 100 thousand addresses per day if you have an account. I decided to open an account and I received a message that I have 60 trial days and they gave a 300 dollars credit. Despite this, I didnt discover where I can find the "client" and "signature" options that ggmap requires.

If someone can tell me where I can find it, please let me know!


My aim is to make Google searches by the address. If address is not recognized, then I make it searches for the local using the zip code. Here is what I am doing:

library(RJSONIO) 
library(RCurl)

getGeoData <- function(location, api_key){
    location <- gsub(' ','+',location)
    geo_data <- getURL(paste("https://maps.googleapis.com/maps/api/geocode/json?address=",location,sprintf("&key=%s",api_key), sep=""))
    geo_data <- fromJSON(geo_data)
    if(geo_data$status=="ZERO_RESULTS"){
        return(NA)
    } else return(geo_data$results[[1]]$geometry$location)
}

New error:

getGeoData(basefinal$cep[6793], "MY KEY")[[2]] Error in getGeoData(basefinal$cep[6793], "MY KEY")[[2]] : subscript out of bounds

Barb
  • 11
  • 3
  • This question might help: http://stackoverflow.com/questions/34402979/increase-the-api-limit-in-ggmaps-geocode-function-in-r – Stedy Jul 22 '16 at 23:58
  • Thx! I saw that. I even used sth similar but it still doesn't work. Idk if I am coding anything wrong but it still doesn't reach more than 2500. I can post my code here. Would you give it a look? – Barb Jul 24 '16 at 02:42
  • sure, edit your question and I will take a look or at least someone else will :) – Stedy Jul 24 '16 at 04:13
  • Thank you! I did it – Barb Jul 25 '16 at 10:49
  • I think this should be okay, your function works fine: `getGeoData("Fenway Park", api_key)` returns `lat lng 30.49 -97.81`. And I think google will automatically increase your quota after setting up payment data. Or am I missing something? – Stedy Jul 25 '16 at 23:39
  • Nice to know the problem is not me Haha! Thank you again :) My key is not being recognized after the 2500th observation. I didn't pay indeed, I just created an account and they said I had these 300 dollars credit. Thought I would use it – Barb Jul 27 '16 at 00:46
  • as per the linked question from @Stedy , the `google_geocode()` function in the `googleway` package will do all the work for you, so you don't have to write your own function – SymbolixAU Jul 28 '16 at 23:22
  • Guys, I solved my problem! Key decided to work :) Thank you very much – Barb Aug 05 '16 at 21:23

0 Answers0