featureCollection
描述
🌐 Description
接受一个或多个 Features 并创建一个 FeatureCollection。
🌐 Takes one or more Features and creates a FeatureCollection.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| features | Array<Feature<GeometryObject, GeoJsonProperties>> | 输入特性 |
| options? | Object | 可选参数 (默认 {}) |
| options.bbox? | BBox | 与要素相关的边界框数组 [西, 南, 东, 北] |
| options.id? | Id | 与功能相关的标识符 |
返回
🌐 Returns
FeatureCollection<GeometryObject, GeoJsonProperties> 要素集合的要素
示例
🌐 Examples
var locationA = turf.point([-75.343, 39.984], { name: "Location A" });
var locationB = turf.point([-75.833, 39.284], { name: "Location B" });
var locationC = turf.point([-75.534, 39.123], { name: "Location C" });
var collection = turf.featureCollection([locationA, locationB, locationC]);
//=collection
安装
🌐 Installation
$ npm install @turf/helpers
import { featureCollection } from "@turf/helpers";
const result = featureCollection(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.featureCollection(...);