MEASUREMENT
COORDINATE MUTATION
TRANSFORMATION
FEATURE_CONVERSION
MISC
HELPER
RANDOM
GRIDS
AGGREGATION
META
ASSERTIONS
BOOLEANS
UNIT CONVERSION
DATA
JOINS
CLASSIFICATION

geometryCollection

geometryCollection 是Turf中的一个辅助函数,用于创建一个几何对象集合。

参数

  • geometries (必填)- 几何对象数组。

返回

示例

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".