geojson-flatten

transform geojson into single-parts

Usage no npm install needed!

<script type="module">
  import geojsonFlatten from 'https://cdn.skypack.dev/geojson-flatten';
</script>

README

geojson-flatten

CircleCI

Flatten MultiPoint, MultiPolygon, MultiLineString, and GeometryCollection geometries in GeoJSON files into simple non-complex geometries.

If a FeatureCollection is passed in, a FeatureCollection is returned. If a single Feature is passed in, an array of Features is returned.

install

npm install --save geojson-flatten

Or download geojson-flatten.js for non-browserify usage.

example

let flatten = require('geojson-flatten');

flattened = flatten(geojsonObject);

cli

With a file input

$ geojson-flatten input.geojson > flattened.geojson

With stdin

$ geojson-random | geojson-flatten > flattened.geojson