javascript - Create a route using a list of coordinates in Google Maps - Stack Overflow

I have a list of lat,lon coordinates as result of tracking a bus. I'm showing the route using Poly

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.

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.

Share Improve this question asked Jul 17, 2013 at 22:36 puma91puma91 3867 silver badges15 bronze badges 2
  • How many of these do you need to do? – geocodezip Commented Jul 17, 2013 at 22:47
  • @geocodezip routes? one at a time – puma91 Commented Jul 17, 2013 at 22:55
Add a ment  | 

2 Answers 2

Reset to default 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

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./p/gmaps-api-issues/issues/detail?id=3824 and possibly add a new issue since your problem is somewhat different

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744772115a4592821.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信