seasketch / geoprocessing

Serverless geoprocessing system
https://seasketch.github.io/geoprocessing
BSD 3-Clause "New" or "Revised" License
14 stars 3 forks source link

clip: test out use of polyclip-ts instead of polygon-clipping library #379

Open twelch opened 4 days ago

twelch commented 4 days ago

It is refactored to use Typescript, uses big integer to solve floating point accuracy causing errors. However it is likely quite a bit slower, unclear how much. Performance testing needed.

Suggest looking at use of setPrecision - https://github.com/luizbarboza/polyclip-ts/issues/5

twelch commented 4 days ago

If polyclip-ts doesn't make sense to use, then we can at least better make use of polygon-clipping methods to prevent infinite loop errors. Right now we naively do chunking of features in user space. This might be better controlled through available environment variables.

Global settings are set via environment variables. POLYGON_CLIPPING_MAX_QUEUE_SIZE and POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS: Aims to prevent infinite loops - usually caused by floating-point math round-off errors. Defaults are 1,000,000.