1.0.5 • Published 3 years ago

points-in-polygons v1.0.5

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

Points In Polygons

No other dependencies, just simple Math..

To install

yarn

yarn add points-in-polygons

npm

npm install points-in-polygons

To use

  1. Template
const { isInsidePolygon } = require('points-in-polygons');
// Notes: Number of coordinates in polygon is more than 2 (and last coordinate should equal to first), max is unlimited,

const polygon_point = ["lat lng","lat lng","lat lng","lat lng","lat lng"];
const coordinates = "lat lng";
console.log(isInsidePolygon(coordinate, polygon_point)); // true || false
  1. Example
const polygon_point = ["12 11","0 10","0 0","10 0","12 11"];
const coordinates = "5 5";
console.log(isInsidePolygon(coordinate, polygon_point)); // true || false

Demo

Author

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago