geometryCollection
Description
Creates a Feature<GeometryCollection> based on a coordinate array. Properties can be added optionally.
Parameters
Name | Type | Description |
---|---|---|
geometries | Array<Point | LineString | Polygon | MultiPoint | MultiLineString | MultiPolygon> | an array of GeoJSON Geometries |
properties? | GeoJsonProperties | an Object of key-value pairs to add as properties (default {}) |
options? | Object | Optional Parameters (default {}) |
options.bbox? | BBox | Bounding Box Array [west, south, east, north] associated with the Feature |
options.id? | Id | Identifier associated with the Feature |
Returns
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(...);