最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin1浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论