mikhailshilkov / leaflet-corridor

Leaflet plugin to draw a polyline with fixed width in meters
MIT License
34 stars 9 forks source link

Invalid corridor width #4

Open azherebtsov opened 5 years ago

azherebtsov commented 5 years ago

The approach to corridor width is too much straightforward, it does not address in any way changing the width of line when latitude grows closer to the pole point (as well as decreasing to south pole).

mikhailshilkov commented 5 years ago

That's a valid remark, feel free to shoot a PR

azherebtsov commented 5 years ago

Oh... Topic is not that simple. I did it with Java using JTS library and it consumed plenty of time.

There are some ready made solutions around like: https://developers.arcgis.com/javascript/3/samples/exp_cors_buffer/ (description here) but even that proprietary service produces unacceptable results (at least for very long polylines like flight routes). Despite the poor implementation ArcGIS solution has very good API and good approach to use CORS-enabled server to render buffers - there must be a bunch of math to produce geodetically-valid results.

For those who would like to do it in JS I'd suggest to start from JTS JavaScript port or maybe ArcGIS service is working fine when used commercially (had no chance to try).