Skip to main content
Version: 7.2.0

geometryCollection

描述

¥Description

基于坐标数组创建一个 Feature<GeometryCollection>。属性可选择性添加。

¥Creates a Feature<GeometryCollection> based on a coordinate array. Properties can be added optionally.

参数

¥Parameters

名称类型描述
geometries数组< | LineString | 多边形 | MultiPoint | MultiLineString | MultiPolygon>一个 GeoJSON 几何体数组
properties?GeoJsonProperties一个键值对对象,用于添加为属性(默认为 {})
options?对象可选参数(默认 {})
options.bbox?BBox与要素关联的边界框数组 [西,南,东,北]
options.id?ID与特性关联的标识符

返回

¥Returns

特性<GeometryCollection, GeoJsonProperties> GeoJSON 几何集合要素

¥Feature<GeometryCollection, GeoJsonProperties> a GeoJSON GeometryCollection Feature

示例

¥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(...);