Skip to content

Latest commit

 

History

History
47 lines (27 loc) · 1.22 KB

README.md

File metadata and controls

47 lines (27 loc) · 1.22 KB

DEPRECATED - replaced with @turf/bbox-clip

turf-bbox-clip

Fast clipping of lines and polygons against a bbox

turf.bbox-clip(feature, bbox)

Takes a Feature and a bbox and clips the feature to the bbox using lineclip.

Parameters

parameter type description
feature Feature feature to clip to the bbox
bbox Array.<number> an Array of bounding box coordinates in the form: [minLon, minLat, maxLon, maxLat]

Example

var bbox = [0, 0, 10, 10];
var poly = turf.polygon([[[2, 2], [8, 4], [12, 8], [3, 7], [2, 2]]]);

var result = turf.bboxClip(poly, bbox);

//=result

Returns Feature.<Polygon>,Feature.<MultiPolygon>,Feature.<MultiLineString>,

Installation

Requires nodejs.

$ npm install turf-bbox-clip

Tests

$ npm test