Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

geojson-equality

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geojson-equality

Check two valid geojson geometries for equality.

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
86K
decreased by-84.28%
Maintainers
1
Weekly downloads
 
Created

What is geojson-equality?

The geojson-equality npm package is used to compare GeoJSON objects for structural equality. It helps in determining if two GeoJSON objects represent the same geometry, even if their coordinates are ordered differently or if they have different properties.

What are geojson-equality's main functionalities?

Compare GeoJSON objects for equality

This feature allows you to compare two GeoJSON objects to check if they are equal. The comparison takes into account the structure and coordinates of the GeoJSON objects.

const GeojsonEquality = require('geojson-equality');
const equality = new GeojsonEquality();

const geojson1 = { "type": "Point", "coordinates": [100.0, 0.0] };
const geojson2 = { "type": "Point", "coordinates": [100.0, 0.0] };

console.log(equality.compare(geojson1, geojson2)); // true

Compare GeoJSON objects with tolerance

This feature allows you to compare two GeoJSON objects with a specified precision tolerance. This is useful when dealing with floating-point inaccuracies.

const GeojsonEquality = require('geojson-equality');
const equality = new GeojsonEquality({ precision: 6 });

const geojson1 = { "type": "Point", "coordinates": [100.000001, 0.000001] };
const geojson2 = { "type": "Point", "coordinates": [100.0, 0.0] };

console.log(equality.compare(geojson1, geojson2)); // true

Compare GeoJSON objects ignoring properties

This feature allows you to compare two GeoJSON objects while ignoring their properties. This is useful when you only care about the geometry and not the associated properties.

const GeojsonEquality = require('geojson-equality');
const equality = new GeojsonEquality({ ignoreProperties: true });

const geojson1 = { "type": "Point", "coordinates": [100.0, 0.0], "properties": { "name": "A" } };
const geojson2 = { "type": "Point", "coordinates": [100.0, 0.0], "properties": { "name": "B" } };

console.log(equality.compare(geojson1, geojson2)); // true

Other packages similar to geojson-equality

Keywords

FAQs

Package last updated on 16 Nov 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc