1.0.3 • Published 9 years ago

turf-overlaps v1.0.3

Weekly downloads
1,326
License
ISC
Repository
github
Last release
9 years ago

turf-overlaps

find whether spatial features overlap

overlap(poly1, poly2)

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

Parameters

parametertypedescription
poly1Featurethe first Feature, containing LineString, Polygon or MultiPolygon geometry
poly2Featurethe 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)
1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago