Skip to main content
Version: 7.0.0

geometryCollection

Description

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

Parameters

NameTypeDescription
geometriesArray<Geometry>an array of GeoJSON Geometries
properties?Objectan Object of key-value pairs to add as properties (default {})
options?ObjectOptional Parameters (default {})
options.bbox?Array<number>Bounding Box Array [west, south, east, north] associated with the Feature
options.id?string | numberIdentifier associated with the Feature

Returns

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