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
| 名称 | 类型 | 描述 |
|---|---|---|
| geojson | FeatureCollection | Geometry | Feature<any> | 输入将被缓冲 |
| radius | number | 绘制缓冲区的距离(允许负值) |
| 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(...);