Skip to main content
Version: 7.3.0

buffer

描述

🌐 Description

计算给定半径的输入要素的缓冲区。

🌐 Calculates a buffer for input features for a given radius.

当使用负半径时,如果它的大小与半径幅度相比太小,生成的几何形状可能无效。如果输入是 FeatureCollection,则输出 FeatureCollection 中只会返回有效的成员——也就是说,输出集合的成员可能比输入少,甚至为空。

🌐 When using a negative radius, the resulting geometry may be invalid if it's too small compared to the radius magnitude. If the input is a FeatureCollection, only valid members will be returned in the output FeatureCollection - i.e., the output collection may have fewer members than the input, or even be empty.

参数

🌐 Parameters

名称类型描述
geojsonFeatureCollection | Geometry | Feature<any>输入将被缓冲
radiusnumber绘制缓冲区的距离(允许负值)
options?Object可选参数 (默认 {})
options.units?Units支持所有有效的 Turf 单位(默认 "kilometers")
options.steps?number步骤数 (默认 8)

返回

🌐 Returns

FeatureCollection | Feature<Polygon | MultiPolygon> | undefined 缓冲功能

示例

🌐 Examples

var point = turf.point([-90.54863, 14.616599]);
var buffered = turf.buffer(point, 500, { units: "miles" });

安装

🌐 Installation

$ npm install @turf/buffer

import { buffer } from "@turf/buffer";
const result = buffer(...);
$ npm install @turf/turf

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