git ssb


0+

noffle / geojson-polygons-equal



Branch:

Stephen Whitmore committed 0.0.1Latest: 4e5b43f on 1/28/2017, 4:48:59 PM
📄README.md
📄index.js
📄package.json
📁test

geojson-polygons-equal

Checks two GeoJSON Polygons or MultiPolygons for equality.

This includes detecting polygons whose coordinates are rotated left or right differently.

Usage

var polyEqual = require('geojson-polygons-equal')

var poly1 = {
  type: 'Polygon',
  coordinates: [
    [
      [0, 0],
      [0, 1],
      [1, 1],
      [1, 0],
      [0, 0]
    ]
  ]
}

var poly2 = {
  type: 'Polygon',
  coordinates: [
    [
      [1, 1],
      [1, 0],
      [0, 0],
      [0, 1],
      [1, 1]
    ]
  ]
}

console.log(polyEqual(poly1, poly2))

outputs

true

API

var polyEquals = require('geojson-polygons-equal')

polyEquals(poly1, poly2)

Compares the two GeoJSON objects poly1 and poly2, which can be either Polygon or MultiPolygon objects.

Install

With npm installed, run

$ npm install geojson-polygons-equal

License

ISC


Built with git-ssb-web