simplify-geometry
Simplify geometry using the Ramer–Douglas–Peucker algorithm.
npm install simplify-geometry
Want to see pretty graphs? Log in now!
3 | downloads in the last day |
4 | downloads in the last week |
24 | downloads in the last month |
Last Published By | |
---|---|
Version | 0.0.1 last updated 10 months ago |
License | MIT |
Keywords | geometry, Douglas–Peucker, simplify |
Repository | git://github.com/seabre/simplify-geometry.git (git) |
Dependencies | None |
Dependents | simplify-geojson |
simplify-geometry
Simplify geometry using the Ramer–Douglas–Peucker algorithm.
If you need to simplify geometries, for instance reducing the number of points in a polygon, this will help you. You could use this in Leaflet and I do have browser builds, but they have not been tested.
Node
Example
var simplify = require('simplify-geometry');
var linestring = [[0,0], [2.5,3], [5,0]];
console.log(simplify(linestring, 2.9));
console.log(simplify(linestring, 3));
Output:
[ [ 0, 0 ], [ 2.5, 3 ], [ 5, 0 ] ]
[ [ 0, 0 ], [ 5, 0 ] ]
Browser
I do have browser builds built with Browserify:
- https://github.com/seabre/simplify-geometry/blob/master/simplifygeometry-0.0.1.js
- https://github.com/seabre/simplify-geometry/blob/master/simplifygeometry-0.0.1.min.js
You should be able to use them, but I do not have examples yet.