1.0.2 • Published 5 years ago

geojson-split-crossing-lines v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

geojson-split-crossing-lines

Turn a GeoJSON FeatureCollection of crossing lines into a clean network dataset.

npm install geojson-split-crossing-lines --save
const splitLines = require('geojson-split-crossing-lines');
const fs = require('fs').promises;

main();

async function main() {
    // load and parse GeoJSON LineString dataset
    const geo_raw = await fs.readFile('./whole.geojson', 'utf8');
    const geo = JSON.parse(geo_raw);

    const split = splitLines(geo);

    await fs.writeFile('./split.geojson', JSON.stringify(split), 'utf8');
}

For more information, please see my blog post; Cleaning a GeoJSON Network.