Skip to content

Turfjs/turf-flatten

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED - replaced with @turf/flatten & @turf/meta

turf-flatten

build status

Turf flatten module

turf.flatten(input)

flattens any GeoJSON to a FeatureCollection using geojson-flatten.

Parameters

parameter type description
input geojson any valid GeoJSON with multi-geometry Features

Example

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.

$ npm install turf-flatten

Tests

$ npm test