Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/hackergrrl/geojson-polygons-equal


https://github.com/hackergrrl/geojson-polygons-equal

Last synced: 1 day ago
JSON representation

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