1

I used the following code succesfululy previously to estimate distances, but suddenly I started receiving the 429 error (HTTP status was '429 Unknown'). Apparently it has to do with the number of requests I sent in a period of time.

I have tried reducing my database size (to 500)and also tried waiting days to run the code again, but the code is not going away. I also tried using `different computers and/or locations (office/house). please help

`#calculate road distance using distm loop    
data[,"distroadeast_miles"] <- NA

for (i in 1:nrow(data)){
 olong<-data[i,"olong"]
 olat<-data[i,"olat"]
 dlong<-data[i,"dlong"]
 dlat<-data[i,"dlat"]
 (url <- paste0("http://router.project-osrm.org/route/v1/driving/", 
             olong,",",olat,";",dlong,",",dlat,"?overview=full"))
 route<- fromJSON(file=url)
 data[i,"distroadeast_miles"] <-route$routes[[1]]$distance#in m
 data[i,"distroadeast_miles"]<- 
 data[i,"distroadeast_miles"]/1609.344#convert m to miles
 }
valeria
  • 9
  • 4

0 Answers0