geometryCollection
是Turf中的一个辅助函数,用于创建一个几何对象集合。
geometries
(必填)- 几何对象数组。GeometryCollection
- 一个几何对象集合。const { geometryCollection } = require('@turf/helpers');
const { point, lineString } = require('@turf/helpers');
const point1 = point([13.4301, 52.5075]);
const point2 = point([13.4015, 52.4989]);
const line = lineString([[13.4301, 52.5075], [13.4015, 52.4989]]);
const gc = geometryCollection([point1, line, point2]);
//=gc
geometries
参数不是数组,则抛出异常 "Invalid input to generate GeometryCollection".