3.0.1 • Published 6 years ago

polyline-clean v3.0.1

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

polyline-clean experimental Build Status

Clean polyline or polygon data: remove duplicate, collinear, null points, etc.

npm install polyline-clean

const c = require('polyline-clean')

// remove duplicate, degenerate or collinear segments
c([[0,0], [null,null], [1,1], [1,1], [.5,.5], [1,1], [3,3]])
// === [[0,0], [3,3]]

c(coordinates, options?)

Return new coordinates array with bad points removed. If result is degenerate, null will be returned.

OptionMeaning
idsReturn indexes in the initial array instead of points.
foldCollapse collinear segments. Can be a number indicating min angle threshold. polygon mode has more rigid folding. Useful to disable it when data has logarithmic fashion.
polygonApply polygon optimizations: remove coinciding end, collinear end segments, ignore degenerate results.

Related

  • parse-poly − parse any polygon/polyline format and return list of coordinates.
  • simplify-path − simplify polyline with tolerance.

License

(c) 2018 Dmitry Yv. MIT License