https://github.com/turfjs/turf-flatten
Turf flatten module
https://github.com/turfjs/turf-flatten
Last synced: 3 months ago
JSON representation
Turf flatten module
- Host: GitHub
- URL: https://github.com/turfjs/turf-flatten
- Owner: Turfjs
- License: mit
- Created: 2015-05-04T13:53:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2017-06-06T13:39:37.000Z (about 8 years ago)
- Last Synced: 2025-02-11T02:19:02.126Z (4 months ago)
- Language: JavaScript
- Homepage: http://turfjs.org/
- Size: 3.91 KB
- Stars: 0
- Watchers: 6
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# DEPRECATED - replaced with [`@turf/flatten`](https://github.com/Turfjs/turf/tree/master/packages/turf-flatten) & [`@turf/meta`](https://github.com/Turfjs/turf/tree/master/packages/turf-meta)
# turf-flatten[](http://travis-ci.org/Turfjs/turf-flatten)
[Turf](http://turfjs.org/) flatten module
### `turf.flatten(input)`
flattens any GeoJSON to a FeatureCollection using [geojson-flatten](https://github.com/mapbox/geojson-flatten).
### Parameters
| parameter | type | description |
| --------- | ------- | ---------------------------------------------- |
| `input` | geojson | any valid GeoJSON with multi-geometry Features |### Example
```js
var geometry = {
"type": "MultiPolygon",
"coordinates": [
[[[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 flattened = turf.flatten(geometry);
//=flattened
```**Returns** `flattened`, a flattened FeatureCollection
## Installation
Requires [nodejs](http://nodejs.org/).
```sh
$ npm install turf-flatten
```## Tests
```sh
$ npm test
```