turf-deintersect
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": -46738586 -23596711 -46738586 -23458207 -46560058 -23458207 -46560058 -23596711 -46738586 -23596711 ;var poly2 = "type": "Feature" "properties": "fill": "#00f" "geometry": "type": "Polygon" "coordinates": -46650009 -23631314 -46650009 -235237 -46509246 -235237 -46509246 -23631314 -46650009 -23631314 ; var deintersected = turf; 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