Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rowanwins/sweepline-simplify
A module for creating simple polygons out of self-intersecting polygons
https://github.com/rowanwins/sweepline-simplify
Last synced: 11 days ago
JSON representation
A module for creating simple polygons out of self-intersecting polygons
- Host: GitHub
- URL: https://github.com/rowanwins/sweepline-simplify
- Owner: rowanwins
- License: mit
- Created: 2019-10-31T10:24:21.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T12:50:26.000Z (almost 2 years ago)
- Last Synced: 2024-10-12T04:17:36.844Z (27 days ago)
- Language: JavaScript
- Size: 936 KB
- Stars: 4
- Watchers: 3
- Forks: 0
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sweepline-simplify
A module for creating simple polygons out of self-intersecting polygons. Based on simplepolygon but made faster.## Install
````
npm install sweepline-simplify
````## Documentation
Valid inputs: Geojson `Polygon` or `MultiPolygon`.````js
const simplify = require('sweepline-simplify')const box = {type: 'Polygon', coordinates: [[[0, 0], [1, 0], [1, 1], [0, 1], [0, 0]]]}
simplify(box)
// true
````## Benchmarks
````
// Basic example
// Sweepline simplify x 76,196 ops/sec ±2.28% (85 runs sampled)
// SimplePolygon x 29,164 ops/sec ±1.10% (85 runs sampled)
// - Fastest is Sweepline simplify// Warsaw example
// Sweepline simplify x 20.27 ops/sec ±4.42% (38 runs sampled)
// simplepolygon - x Breaks
// - Fastest is Sweepline simplify
````### Acknowledgements
This library leans heavily on the work in the [simplepolygon library](https://github.com/mclaeysb/simplepolygon/). The core difference is in swapping out the algorithm for finding the self-intersections.
Rbush has also been removed to reduce dependencies however this has made performance a bit slower so that needs investigation.