Skip to content

KBE3D / KBCore / turf / bboxClip

函数: bboxClip()

bboxClip<G, P>(feature: G | Feature<G, P>, bbox: BBox): Feature<LineString, { } | P> | Feature<MultiLineString, { } | P> | Feature<Polygon, { } | P> | Feature<MultiPolygon, { } | P>

Function

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

. May result in degenerate edges when clipping Polygons.

类型参数

G

G extends LineString | MultiLineString | Polygon | MultiPolygon

P

P extends GeoJsonProperties = GeoJsonProperties

参数

feature

feature to clip to the bbox

G | Feature<G, P>

bbox

BBox

extent in [minX, minY, maxX, maxY] order

返回

Feature<LineString, { } | P> | Feature<MultiLineString, { } | P> | Feature<Polygon, { } | P> | Feature<MultiPolygon, { } | P>

clipped Feature

示例

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

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

//addToMap
var addToMap = [bbox, poly, clipped]

KBE3D @3.0.0 Copyright © 2024-present KBE3D