Estefy Estefy - 3 months ago 21
R Question

Google Maps shortest distance

I have a dataset with start (X) and end (Y) coordinates. I want to extract the shortest distance from X to Y using Google Maps. Is there any package/function I can use to do this in R?

Thanks,

Answer

@Dave2e is right. use the function mapdist() from library(ggmap). It has also an argument to set the type of distance to compute (see function argument mode = c("driving", "walking", "bicycling")). Remember that google maps api limits to 2500 element queries a day.

Comments