turf-overlaps
find whether spatial features overlap
Last updated 12 years ago by tcql .
ISC · Repository · Bugs · Original npm · Tarball · package.json
$ npm install turf-overlaps 
SYNC missed versions from official npm registry.

turf-overlaps

find whether spatial features overlap

overlap(poly1, poly2)

Takes two Linestring, Polygon or MultiPolygon features and finds whether they overlap.

Parameters

parameter type description
poly1 Feature the first Feature, containing LineString, Polygon or MultiPolygon geometry
poly2 Feature the second Feature, containing LineString, Polygon or MultiPolygon geometry

Example

var poly1 = turf.polygon([[
  [0, 0],
  [0, 2],
  [2, 2],
  [2, 0],
  [0, 0]
]]);

var poly2 = turf.polygon([[
  [1, 1],
  [1, 3],
  [3, 3],
  [3, 1],
  [1, 1]
]]);

var overlapping = overlaps(poly1, poly2);

// true

Installation

$ npm install --save turf-overlaps

Usage

overlaps = require('turf-overlaps');

var is_overlapping = overlap(poly1, poly2);

Tests

$ npm test

Todo

  • Add tests for MultiPolygon
  • Add tests for testing overlaps for non-homogenous types (LineString vs Polygon, etc)

Current Tags

  • 1.0.3                                ...           latest (12 years ago)

4 Versions

  • 1.0.3                                ...           12 years ago
  • 1.0.2                                ...           12 years ago
  • 1.0.1                                ...           12 years ago
  • 1.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Total 25
Today 0
This Week 2
This Month 16
Last Day 0
Last Week 6
Last Month 7
Dependencies (1)
Dev Dependencies (5)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE