simplify-geometry

Simplify geometry using the Ramer–Douglas–Peucker algorithm.

npm install simplify-geometry
4 downloads in the last week
22 downloads in the last month

simplify-geometry

Build Status

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:

You should be able to use them, but I do not have examples yet.

License

MIT License

npm loves you