turf-buffer icon indicating copy to clipboard operation
turf-buffer copied to clipboard

geodesic polygon buffer

Open morganherlocker opened this issue 11 years ago • 1 comments

morganherlocker avatar Jun 01 '14 01:06 morganherlocker

Hello Morgan,

I've implemented a prototype of geodesic buffer here: https://github.com/aparshin/turf-buffer/tree/geodesic There is a Leaflet page for debug added there, but it requires to browserify sources (browserify index.js --standalone buffer > bundle.js).

The algorithm is simple: manually construct geodesic buffers for each line segment (taken from artisinal branch) and then union them using JSTS (CascadedPolygonUnion can be used to speedup things a little). There are couple issues with this implementation:

  • More accurate segment buffer should be constructed for long segments (in fact, it is more theoretical issue then real use case)
  • The algorithm is really slow!

We had implemented similar algorithm in our Web-GIS and faced performance problem. Here is my question in JSTS mailing list about possible faster algorithms: http://sourceforge.net/p/jts-topo-suite/mailman/message/31906899/

I think the following variant will be faster for small and medium-size geometries:

  • split geometry into small enough pieces (relative to the Earth size)
  • project each peace to local orthographic projection
  • apply classical buffer from JSTS
  • project resulting buffer back to geographic projection
  • union buffers

What do you think about this? Maybe, you have any other ideas?

aparshin avatar Feb 05 '15 15:02 aparshin