This is a `playground`

to test code. It runs a full `Node.js`

environment and already has all of `npm`

’s 400,000 packages pre-installed, including `mh-simplify-coordinates`

with all `npm`

packages installed. **Try it out**:

var mhSimplifyCoordinates = require("mh-simplify-coordinates")

- all documents on RunKit are public
`require()`

any package directly from npm- use arrow functions, classes, template strings, and most of ES6
`await`

any promise instead of using callbacks (example)- create your own embedded
**node.js**snippets

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

**Algorithm based on Ramer–Douglas–Peucker Algorithm it simplify coordinates by kilometers**

The starting curve is an ordered set of points or lines and the distance dimension

ε> 0.The algorithm Recursion divides the line. Initially it is given all the points between the first and last point. It automatically marks the first and last point to be kept. It then finds the point that is furthest from the line segment with the first and last points as end points; this point is obviously furthest on the curve from the approximating line segment between the end points. If the point is closer than

εto the line segment, then any points not currently marked to be kept can be discarded without the simplified curve being worse thanε.If the point furthest from the line segment is greater than

εfrom the approximation then that point must be kept. The algorithm recursively calls itself with the first point and the furthest point and then with the furthest point and the last point, which includes the furthest point being marked as kept.When the recursion is completed a new output curve can be generated consisting of all and only those points that have been marked as kept.

```
npm install mh-simplify-coordinates
MHSimplify(coord,k)
```

simplify coordinates

https://mh-location.firebaseapp.com/

- package on npmhttps://npmjs.com/package/mh-simplify-coordinates
- licenseISC

RunKit is a free, in-browser JavaScript dev environment for prototyping **Node.js** code, with every **npm** package installed. Sign up to share your code.

Sign Up for Free