3

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) enter image description here

And this is what I need. enter image description here

Thanks for your help.

puma91
  • 336
  • 6
  • 15

2 Answers2

3

I would suggest reducing the polylines to the minimum number of waypoints required to make the DirectionsServide create the same route.

example from this similar question

example using coordinates rather than addresses

Community
  • 1
  • 1
geocodezip
  • 158,664
  • 13
  • 220
  • 245
  • It is a solution that I already considered but I was told that there is a "fastest way" using the API. Anyway, I'm gonna use this, thanks for the links! they are helpful – puma91 Jul 18 '13 at 00:05
2

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

MymsMan
  • 191
  • 8