geojson-equality

WebJar for geojson-equality

Лицензия

Лицензия

MIT
Категории

Категории

Geo Прикладные библиотеки Geospatial JSON Данные
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

geojson-equality
Последняя версия

Последняя версия

0.1.6
Дата

Дата

Тип

Тип

jar
Описание

Описание

geojson-equality
WebJar for geojson-equality
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/geosquare/geojson-equality

Скачать geojson-equality

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/geojson-equality/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>geojson-equality</artifactId>
    <version>0.1.6</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/geojson-equality/
implementation 'org.webjars.npm:geojson-equality:0.1.6'
// https://jarcasting.com/artifacts/org.webjars.npm/geojson-equality/
implementation ("org.webjars.npm:geojson-equality:0.1.6")
'org.webjars.npm:geojson-equality:jar:0.1.6'
<dependency org="org.webjars.npm" name="geojson-equality" rev="0.1.6">
  <artifact name="geojson-equality" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='geojson-equality', version='0.1.6')
)
libraryDependencies += "org.webjars.npm" % "geojson-equality" % "0.1.6"
[org.webjars.npm/geojson-equality "0.1.6"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : deep-equal jar [1.0.0,2)

Модули Проекта

Данный проект не имеет модулей.

geojson-equality

Check two valid geojson geometries for equality.

installation

npm install geojson-equality

usage

var GeojsonEquality = require('geojson-equality');
var eq = new GeojsonEquality();
 
var g1 = { "type": "Polygon", "coordinates": [
  [[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]
]};
var g2 = { "type": "Polygon", "coordinates": [
  [[30, 10], [40, 40], [20, 40], [10, 20], [30, 10]]
]};

eq.compare(g1,g2);    // returns true
var g3 = { "type": "Polygon", "coordinates": [
  [[300, 100], [400, 400], [200, 400], [100, 200], [300, 100]]
]};

eq.compare(g1,g3);    // returns false

For including in browser, download file geojson-equality.min.js

<script type="text/javascipt" src="path/to/geojson-equality.min.js"></script>

This create a global variable 'GeojsonEquality' GeojsonEquality class can be initiated with many options that are used to match the geojson.

  • precision number as floating points precision required. Defualt is 17
var g1 = { "type": "Point", "coordinates": [30.2, 10] };
var g2 = { "type": "Point", "coordinates": [30.22233, 10] };
var eq = new GeojsonEquality({precision: 3});
eq.compare(g1,g2);  // returns false
var eq = new GeojsonEquality({precision: 1});
eq.compare(g1,g2);  // returns true
  • direction true | false, direction of LineString or Polygon (orientation) is ignored if false. Default is false.
  var g1 = { "type": "LineString", "coordinates": 
    [ [30, 10], [10, 30], [40, 40] ] };
  var g2 = { "type": "LineString", "coordinates": 
    [ [40, 40], [10, 30], [30, 10] ] };
  var eq = new GeojsonEquality({direction: false});
  eq.compare(g1,g2);  // returns true
  var eq = new GeojsonEquality({direction: true});
  eq.compare(g1,g2);  // returns false
  • objectComparator function, custom function for use in comparing Feature properties. Default is a shallow comparison.
  // using lodash isEqual to deep comparison
  var isEqual = require('lodash/lang/isEqual')
  var eq = new GeojsonEquality({objectComparator: isEqual});

developing

Once you run

npm install

then for running test

npm run test

to create build

npm run build

license

This project is licensed under the terms of the MIT license.

Версии библиотеки

Версия
0.1.6