https://github.com/hackergrrl/geojson-polygons-equal
https://github.com/hackergrrl/geojson-polygons-equal
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hackergrrl/geojson-polygons-equal
- Owner: hackergrrl
- Created: 2017-01-28T21:46:07.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-01-28T21:46:13.000Z (over 8 years ago)
- Last Synced: 2025-03-24T05:49:30.887Z (4 months ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# geojson-polygons-equal
> Checks two GeoJSON Polygons or MultiPolygons for equality.
This includes detecting polygons whose coordinates are rotated left or right
differently.## Usage
```js
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
```js
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](https://npmjs.org/) installed, run
```
$ npm install geojson-polygons-equal
```## License
ISC