@turf/flatten
TypeScript icon, indicating that this package has built-in type declarations

7.0.0 • Public • Published

@turf/flatten

flatten

Flattens any GeoJSON to a FeatureCollection inspired by geojson-flatten.

Parameters

  • geojson GeoJSON any valid GeoJSON Object

Examples

var multiGeometry = turf.multiPolygon([
  [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
  [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
  [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]);

var flatten = turf.flatten(multiGeometry);

//addToMap
var addToMap = [flatten]

Returns FeatureCollection<any> all Multi-Geometries are flattened into single Features


This module is part of the Turfjs project, an open source module collection dedicated to geographic algorithms. It is maintained in the Turfjs/turf repository, where you can create PRs and issues.

Installation

Install this single module individually:

$ npm install @turf/flatten

Or install the all-encompassing @turf/turf module that includes all modules as functions:

$ npm install @turf/turf

Package Sidebar

Install

npm i @turf/flatten

Weekly Downloads

371,156

Version

7.0.0

License

MIT

Unpacked Size

13.2 kB

Total Files

9

Last publish

Collaborators

  • morgan.herlocker
  • twelch
  • jamesmilneruk
  • rowanwins
  • tmcw
  • morganherlocker
  • tcql
  • mdfedderly