featureCollection
Description
Takes one or more Features and creates a FeatureCollection.
Parameters
Name | Type | Description |
---|---|---|
features | Array<Feature<GeometryObject, GeoJsonProperties>> | input features |
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
FeatureCollection<GeometryObject, GeoJsonProperties> FeatureCollection of Features
Examples
var locationA = turf.point([-75.343, 39.984], { name: "Location A" });
var locationB = turf.point([-75.833, 39.284], { name: "Location B" });
var locationC = turf.point([-75.534, 39.123], { name: "Location C" });
var collection = turf.featureCollection([locationA, locationB, locationC]);
//=collection
Installation
$ npm install @turf/helpers
import { featureCollection } from "@turf/helpers";
const result = featureCollection(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.featureCollection(...);