问题
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):
And I would like something like that:
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
Polyline
s the ability to be drawn with a relative pixel offset, without modifying their actualLatLng
s. 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