Quantifying the distance using Google_distance r function

Viewed 44

I'm trying to quantify the distance between localities, applying the Google_distance r function. I have run the examples of the Google_distance function, but the distance between localities is missing. The others fields are complete, but not the distance.

I have activated just the distance API from google.

The code is:

key <- "your key here"
set_key(key = key, api = "distance")
google_keys()

df <- google_distance(origins = list(c("Melbourne Airport, Australia"),
                                     c("MCG, Melbourne, Australia"),
                                     c(-37.81659, 144.9841)),
                      destinations = c("Portsea, Melbourne, Australia"),
                      key = key) 


head(df)

$destination_addresses
\[1\] "Portsea VIC 3944, Australia"

$origin_addresses
\[1\] "Melbourne Orlando International Airport (MLB), 1 Air Terminal Pkwy, Melbourne, FL 32901, USA"
\[2\] "Brunton Ave, Richmond VIC 3002, Australia"  
\[3\] "Jolimont, Wellington Cres, East Melbourne VIC 3002, Australia"

$rows
\*\*\* Empty \*\*\*
$status
\[1\] "OK"


Perhaps, I need to turn on others google APIs, but I am not sure which ones. Do you have any idea how I could solve this issue?

All suggestions and improvements are welcome, Thank you very much

0 Answers
Related