Simplify geometry using the Ramer–Douglas–Peucker algorithm.

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.

var simplify = require'simplify-geometry';var linestring = 00 2.53 50; console.logsimplifylinestring 2.9;console.logsimplifylinestring 3;

Output:

0 0 2.5 3 5 0 0 0 5 0

Browser builds are built with Browserify, and tested in various browsers with Testling:

- https://github.com/seabre/simplify-geometry/blob/master/simplifygeometry-0.0.2.js
- https://github.com/seabre/simplify-geometry/blob/master/simplifygeometry-0.0.2.min.js

You can see an example here, which uses Leaflet: http://seabre.github.io/simplify-geometry/

With example code here: https://github.com/seabre/simplify-geometry/tree/master/examples/browser