My client makes deliveries and needs to record the mileage driven between each stop as well as a total miles for the day. The route is known ahead of time. The addresses are also known so I am able to obtain the lat/long of the addresses for Google maps. I’d like to get the distance for each leg and record them in the database for end of year reporting as well as a grand total of miles driven for the year (the grand total is the easy part so that doesn’t really need to be addressed).
1) Is this possible with the current Google Maps API? I have the Google map key.
2) If yes, do you have a link to a demo that I can look at?
I’m coding this in ColdFusion but would be open to reverse engineering a PHP page.
This is possible, you have to request the directionsService. The service-response will contain the distance for each step(example), you only need to fetch the desired data out of the response.
Note: you may only request routes with up to 8 waypoints, when your routes include more waypoints you must split the routes.