问题
I've drawn a polygon and I want to draw a perpendicular line to this polygon. I found the computeOffset function of google maps api from here, but I'm using Leaflet. Is there an equivalent function in Leaflet?
Here is a screenshot of drawing the polyline.
I want to draw the perpendicular line that passes through the start point of the drawing polyline (the start point is marked with a marker on the screenshot). The expected result is like this.
Thank you.
回答1:
No, Leaflet has no equivalent.
You'll have to resort to a geodetic utility library for this kind of calculations. See cheap-ruler, geographiclib and Turf.js.
来源:https://stackoverflow.com/questions/42514896/how-to-draw-polyline-perpendicular-to-another-polyline-using-leaflet