How to draw path superposition with different color on leaflet.js?

天大地大妈咪最大 提交于 2021-02-08 05:43:21

问题


I would like to draw several paths from same coordinates on a leaflet.js map. I have thought about making the gap between paths with trigonometric computations, but it's too complex to deal with teh zoom level, translate GPS coordinates to a vector, etc.

The drawing I have now is like this (another path is under the green path):

enter image description here

And I would like something like that:

enter image description here

Of course, the coordinates, angle and zoomlevel can change.


回答1:


You would probably be interested in Leaflet Polyline Offset plugin:

This plugin adds to Leaflet Polylines the ability to be drawn with a relative pixel offset, without modifying their actual LatLngs. The offset value can be either negative or positive, for left- or right-side offset, and remains constant across zoom levels.

Bus lines demo



来源:https://stackoverflow.com/questions/45193353/how-to-draw-path-superposition-with-different-color-on-leaflet-js

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