Flattens any GeoJSON to a FeatureCollection
npm install @turf/flattenFlattens any [GeoJSON][1] to a [FeatureCollection][2] inspired by [geojson-flatten][3].
* geojson [GeoJSON][1] any valid GeoJSON Object
``javascript
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][2]\
[1]: https://tools.ietf.org/html/rfc7946#section-3
[2]: https://tools.ietf.org/html/rfc7946#section-3.3
[3]: https://github.com/tmcw/geojson-flatten
---
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.
Install this single module individually:
`sh`
$ npm install @turf/flatten
Or install the all-encompassing @turf/turf module that includes all modules as functions:
`sh``
$ npm install @turf/turf