parse-poly

1.0.1 • Public • Published

parse-poly experimental Build Status

Take in any polygon or polyline argument and return array of coordinates. The returned array is always a copy of initial argument.

npm install parse-poly

const parsePoly = require('parse-poly')
 
// [[10, 20], [30, 40], [50, 60]]
parsePoly('10 20 30 40 50 60')
parsePoly(10, 20, 30, 40, 50, 60)
parsePoly([10, 20, 30, 40, 50, 60])
parsePoly([10, 20], [30, 40], [50, 60])
parsePoly([[10, 20], [30, 40], [50, 60]])
parsePoly(new Float32Array([10, 20, 30, 40, 50, 60]))
parsePoly([new Float32Array([10, 20]), new Float32Array([30, 40]), new Float32Array([50, 60])])
parsePoly([{x: 10, y: 20}, {x: 30, y: 40}, {x: 50, y: 60}])
parsePoly({
  "type": "Feature",
  "geometry": {
    "type": "Polygon",
    "coordinates": [[10, 20], [30, 40], [50, 60]]
  }
})

License

(c) 2018 Dmitry Yv. MIT License

Package Sidebar

Install

npm i parse-poly

Weekly Downloads

4

Version

1.0.1

License

MIT

Unpacked Size

6.26 kB

Total Files

7

Last publish

Collaborators

  • dfcreative