0.1.0-alpha.1 • Published 4 years ago

geojson-linestring-concat v0.1.0-alpha.1

Weekly downloads
4
License
MIT
Repository
github
Last release
4 years ago

geojson-linestring-concat

Concatenate GeoJSON LineStrings as much as possible.

Install

  • Install with npm: npm install geojson-linestring-concat.
  • Install with yarn: yarn add geojson-linestring-concat.

Usage

import lineConcat from 'geojson-linestring-concat'
const data = [
    {
        type: 'LineString',
        coordinates: [
            [0.0, 0.0],
            [1.0, 1.0],
            [2.0, 2.0],
        ],
    },
    {
        type: 'LineString',
        coordinates: [
            [2.0, 2.0],
            [3.0, 3.0],
        ],
    },
]
const result = lineConcat(data)
console.log(result)

outputs

{
    type: 'LineString',
    coordinates: [
        [0, 0],
        [1, 1],
        [2, 2],
        [3, 3],
    ],
}