Calculating Driving Distance between two waypoints

Dear all,

I wonder if there is any way to calculate driving distance and driving time between two waypoints? I have checked Googlemaps Distance Matrix API, but I couldn’t find any solid example that is used in Julia.

Any help would be appreciated!

There is but it is slightly out of date, you might consider taking it as a starting point and making a PR if you get it to work.

Thank you for the response. I already checked it, not useful, I am using Julia 1.3.0, and it is not recognizing functions, etc written in this code. I found this:, however I dont know how to introduce my GoogleMaps_API_key into the code. Is there anyone knowing this? Replacing my API_key with “GOOGLE_MAPS_KEY” in the fifth row doesn’t work.

Thank you

You need to set an environment variable, i.e. in Julia do ENV["GOOGLE_MAPS_KEY"] = your_api_key and then do ENV["GOOGLE_MAPS_KEY"] should return your api - this environment variable is what the package queries.

Thank you for the response.

Unfortunately, I am having error saying:

UndefVarError: [[REDACTED]] not defined

[1] top-level scope at In[6]:4

Does anyone know why? Is there anything wrong with my googlemaps key?

Environment variables need to be strings. So if your API key is foo123, you need to do

ENV["GOOGLE_MAPS_KEY"] = "foo123"

and not


If you do the latter, julia looks for a variable called foo123. Also, if the error message you’ve posted above contains your actual API key, you might want to delete that.

1 Like