Skip to main content
Version: 7.3.0

bboxClip

描述

🌐 Description

使用lineclipFeature和边界框裁剪到边界框内。裁剪多边形时可能会产生退化的边。

🌐 Takes a Feature and a bbox and clips the feature to the bbox using lineclip. May result in degenerate edges when clipping Polygons.

参数

🌐 Parameters

名称类型描述
featureFeature<LineString | MultiLineString | Polygon | MultiPolygon>将功能裁剪到边界框
bboxBBox范围按 [minX, minY, maxX, maxY] 顺序

返回

🌐 Returns

Feature<LineString | MultiLineString | Polygon | MultiPolygon> 剪辑特性

示例

🌐 Examples

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);

安装

🌐 Installation

$ npm install @turf/bbox-clip

import { bboxClip } from "@turf/bbox-clip";
const result = bboxClip(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.bboxClip(...);