geometryCollection
描述
🌐 Description
基于坐标数组创建一个 Feature<GeometryCollection>。可以选择性地添加属性。
🌐 Creates a Feature<GeometryCollection> based on a coordinate array. Properties can be added optionally.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| 几何图形 | 数组<点 | 线串 | 多边形 | 多点 | 多线串 | 多多边形> | 一个 GeoJSON 几何图形的数组 |
| properties? | GeoJsonProperties | 一个作为属性添加的键值对对象 (默认 {}) |
| options? | 对象 | 可选参数 (默认 {}) |
| options.bbox? | BBox | 与要素关联的边界框数组 [西,南,东,北] |
| options.id? | Id | 与功能关联的标识符 |
返回
🌐 Returns
Feature<GeometryCollection, GeoJsonProperties> 一个 GeoJSON 几何集合要素
示例
🌐 Examples
var pt = turf.geometry("Point", [100, 0]);
var line = turf.geometry("LineString", [
[101, 0],
[102, 1],
]);
var collection = turf.geometryCollection([pt, line]);
// => collection
安装
🌐 Installation
$ npm install @turf/helpers
import { geometryCollection } from "@turf/helpers";
const result = geometryCollection(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.geometryCollection(...);