Skip to content

Clips a Feature by a bbox

Notifications You must be signed in to change notification settings

Turfjs/turf-bbox-clip

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Releases

No releases published

Packages

No packages published