Create a route using a list of coordinates in Google Maps

google-maps, javascript

Solution

Search for 'snap polyline to road using google maps api v3' for similar discussions.

There doesn't appear to be a straightforward API service to do this and you would need to reduce your route to significant changes in direction rather than every wiggle.

You might add a star to the issue in the 'Google Maps API bug reports and feature requests' database http://code.google.com/p/gmaps-api-issues/issues/detail?id=3824 and possibly add a new issue since your problem is somewhat different

Problem

I have a list of lat,lon coordinates as result of tracking a bus. I'm showing the route using PolyLine to create a line to connect "the dots" but because of the accuracy these dots aren't exactly by the street, and when you zoom in it is more obvious. What can I do to show the route by the street? This is what I have right now (There are 2 lines because the bus did 2 turns. It won't show like this in the final product) And this is what I need. Thanks for your help.

Original source

Related problems