描述
基于坐标数组创建 Feature<GeometryCollection>。可选添加属性。
参数
| 名称 | 类型 | 描述 |
|---|---|---|
| geometries | Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon> | GeoJSON 几何体数组 |
| properties? | GeoJsonProperties | 作为属性添加的键值对对象 (默认 {}) |
| options? | Object | 可选参数 (默认 {}) |
| options.bbox? | BBox | 与 Feature 关联的边界框数组 [西, 南, 东, 北] |
| options.id? | Id | 与 Feature 关联的标识符 |
返回值
Feature<GeometryCollection, GeoJsonProperties> GeoJSON GeometryCollection Feature
示例
javascript
var pt = turf.geometry("Point", [100, 0]);
var line = turf.geometry("LineString", [
[101, 0],
[102, 1],
]);
var collection = turf.geometryCollection([pt, line]);
// => collection安装
javascript
$ npm install @turf/helpers
import { geometryCollection } from "@turf/helpers";
const result = geometryCollection(...);javascript
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.geometryCollection(...);