1.0.4 • Published 6 years ago

turf-deintersect v1.0.4

Weekly downloads
25
License
MIT
Repository
github
Last release
6 years ago

turf-deintersect

build status

Delete GeoJSON polygon intersections

turf.deintersect(polygons)

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

Parameters

parametertypedescription
polygonsArray.\<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
1.0.4

6 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

8 years ago

1.0.0

8 years ago