turf-deintersect

1.0.4 • Public • Published

turf-deintersect

build status

Delete GeoJSON polygon intersections

turf.deintersect(polygons)

Delete Polygon|polygons intersections by clipping from next polygon each previous polygon.

Parameters

parameter type description
polygons Array.<Polygon> input polygon features

Example

var poly1 = {
  "type": "Feature",
  "properties": {
    "fill": "#0f0"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.738586, -23.596711],
      [-46.738586, -23.458207],
      [-46.560058, -23.458207],
      [-46.560058, -23.596711],
      [-46.738586, -23.596711]
    ]]
  }
};
var poly2 = {
  "type": "Feature",
  "properties": {
    "fill": "#00f"
  },
  "geometry": {
    "type": "Polygon",
    "coordinates": [[
      [-46.650009, -23.631314],
      [-46.650009, -23.5237],
      [-46.509246, -23.5237],
      [-46.509246, -23.631314],
      [-46.650009, -23.631314]
    ]]
  }
};
 
var deintersected = turf.deintersect([poly1, poly2]);
 
var polygonsBefore = {
  "type": "FeatureCollection",
  "features": [poly1, poly2]
};
 
var polygonsAfter = {
  "type": "FeatureCollection",
  "features": deintersected
};
 
//=polygonsBefore
 
//=polygonsAfter

Returns Array.<Polygon>, a polygon features without intersections

Installation

Requires nodejs.

$ npm install turf-deintersect

Tests

$ npm test

Readme

Keywords

Package Sidebar

Install

npm i turf-deintersect

Weekly Downloads

3

Version

1.0.4

License

MIT

Unpacked Size

81.3 kB

Total Files

7

Last publish

Collaborators

  • stepankuzmin