DerekYves / placement

Drivetime, distance, and geocoding in R via the Google Maps API
Other
21 stars 3 forks source link

Test for "OVER_QUERY_LIMIT" #5

Open jcanistrum-uminho opened 7 years ago

jcanistrum-uminho commented 7 years ago

Hi,

I was using placement when I started to face an error message

 Error in vapply(json, function(x) { : values must be length 11,
 but FUN(X[[1]]) result is length 0 

after some debug I found the reason to be a JSON returning NULL as the Status was "OVER_QUERY_LIMIT" and as the status is only tested here

  #raise error if response is denied
  if (json[[1]]$status == 'REQUEST_DENIED') {
    stop(paste0(
      "Request sent to Google, but response returned REQUEST_DENIED.  Error details:\n", 
      json[[1]]$error_message
    ))
  }

So probably would be better to test to the both statuses or for the status not = OK.

Regards

Coop197823 commented 6 years ago

Did you ever solve this issue? I am running into the same thing