Polylines appearing on map where they shouldn't

此生再无相见时 提交于 2019-11-30 10:24:20
FabianCook

There appears to be a bug open for it: https://code.google.com/p/gmaps-api-issues/issues/detail?id=5313

EDIT

It appears if you filter vertices that are closer than 1 meter to each other the the bug is resolved. I will write some code to fix this later tonight and put it here.

UPDATE

This bug was handled in Google issue tracker

https://issuetracker.google.com/issues/35821816

It was fixed in Google Play Services - 9.2.56

https://developers.google.com/maps/documentation/android-api/releases#june_27_2016

Here is an approach that fixed this issue for us. Not necessarily the ideal solution, but it works. At certain zoom levels you may see a polyline extend beyond where it should be (like the pictures show above). If you keep changing your zoom level the extension would disappear and then reappear. This happened to us everytime when two coordinates were exactly the same. e.g.

Lets say you have 3 coordinates A,B,C. Bus starts from A and goes to B, the bus then turns around and comes to C. If A and C are the exact same coordinates you would see this polyline extension problem.

After a few approaches we settled on offseting the latitude of point C by .00001. That has fixed all our issues.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!