Display the estimated time of arrival between two fix destinations. Based on Particle MCU and Paperino ePaper.
To make the experience fit your profile, pick a username and tell us what interests you.
We found and based on your interests.
trafficIndicator.zipDemo sketch and Paperino Epaper library PL_microEPDZip Archive - 9.02 kB - 07/25/2017 at 17:00 |
|
To get the live traffic data you need to use an individual API key from Google Maps. This is free and easy to get: Go to this page and klick the button "Get a Key": https://developers.google.com/maps/documentation/distance-matrix .
The HTTP request should contain the individual start address, destination address and your private API key. As a starting point you can try this example in combination with your key:
https://maps.googleapis.com/maps/api/distancematrix/json?units=imperial&origins=Washington,DC&destinations=New+York+City,NY&departure_time=now&traffic_model=best_guess&key=YOUR_API_KEY
By inserting this line in the browser URL field you should get the estimated time of arrival and the distance for the requested route in the JSON format. If this works fine just replace the origins and destination address with your own examples. Great!
At Particle's Console in the Web IDE, following the section "Integration" and "New Integration" we can generate a new Webhook via Browser IDE by selecting "Webhook".
Event Name = TrafficIndicator (or anything else you'd like to use in the sketch lateron)
URL = (the above generated & tested HTTP request string)
Request Type = GET
Device = (Your device name)
Response Template = {{origin_addresses}}~{{destination_addresses}}~{{#rows}}{{#elements}}{{distance.text}}~{{duration_in_traffic.text}}{{/elements}}{{/rows}}
Include Default Data = Yes
Enforce SSL = Yes
(Remaining fields can be left blank)
Create an account to leave a comment. Already have an account? Log In.
Become a member to follow this project and never miss any updates