rodazuero / gmapsdistance

Future
GNU General Public License v3.0
75 stars 40 forks source link

Only mode "driving" works. transit / walking / bicycling have replacement error. #53

Open vince-p opened 5 years ago

vince-p commented 5 years ago

Editing this to describe the error better:

When i set the mode to "driving" the gmapsdistance function works fine, but setting any other mode results in an error.

Here is the code I am running: gmapsdistance( key=<MYKEY>, origin= "St+Peters,+NSW", destination = "Glebe,+NSW", mode="driving", shape = "wide", avoid = "", departure = 1557086400, traffic_model = "pessimistic" )

That works perfectly fine. But when I change the mode to "transit" or "walking" or "bicycling" then I get the following error:

Error in data$Time[i] <- as(rowXML[[duration_key]][1L]$value[1L]$text, : replacement has length zero

jlacko commented 2 years ago

this issue has been resolved in issue 4.0.0 on CRAN since 2022-04-26

the root cause was that the traffic model is a recognized parameter of Google API call only for mode driving / see https://developers.google.com/maps/documentation/distance-matrix/distance-matrix?hl=en#traffic_model