开发者

Prevent two google maps polylines overlapping

I'm making a google maps app that displays GPX tracks. Some of the tracks do overlap for a distance. They do not have identical points, but the polylines seems identical when they are drawn. This makes one of them disapear behind the other one. The solution would be to draw overlapping tracks next to each other, like subway maps do. How ca开发者_如何学Cn I do this in the simplest possible way?


Drawing side-by-side polylines automatically would be very difficult. The maths is tricky even if you were doing it for a fixed zoom level. The lines would have to be recalculated and redrawn for each zoom level because the lat/lng offsets required to offset the lines by the same pixel width doubles for each zoom level.

If you've only got a few tracks, try displaying them in contrasting colours with different widths, displaying the wider ones first. That way you can see the sides of a wider track when a later narrow track is drawn above it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜