I have visited this area a few times. I needed a clean solution to get drive times for my commute home. Fortunately Google Maps Distance Matrix has an easy to use API. Of course you will need to enable the API in your Google Dev Console and get your API key to use the traffic feature.
Once your have your key its a cinch.
- Grab your origination and destination LAT, LONG coordinates. Just go to google maps, find your location, right click on the map and select What's Here from the menu. You will see your coordinates.
- Plug these into the script
- You can tweak the model if you want. Distance Matrix has 3 traffic models, best-guess, pesimistic, and optimistic.
- Run the script
Powershell
Python
In order to get the Python Script to work we have to bypass the SSL verification. Probably not the best idea for production type implementations but it is a workaround.You can find more information about the Distance Matrix API here: https://developers.google.com/maps/documentation/distance-matrix/
0 comments:
Post a Comment