🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

polyline-splitter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

polyline-splitter

Split polylines by other polylines.

latest
Source
npmnpm
Version
0.0.2
Version published
Maintainers
1
Created
Source

polyline-splitter

A small (<10kb minified) javascript library for splitting geojson polylines by other polylines.

Install

npm install polyline-splitter

API

Accepts either a geojson Feature<LineString | MultiLineString> or LineString | MultiLineString.

Returns a MultiLineString containing the joined lines. If no intersection points are found returns the first argument.

import polylineSplitter from 'polyline-splitter'
// or
const polylineSplitter = require('polyline-splitter')

const line1 = {
    "type": "LineString",
    "coordinates": [[0, 0],[10, 0]]
}

const line2 = {
    "type": "LineString",
    "coordinates": [[5, -10],[5, 10]]
}
const output = polylineSplitter(line1, line2)
// => {
//   "type":"MultiLineString",
//   "coordinates":[
//       [[0,0], [5,0]],
//       [[5,0], [10,0]],
//       [[5,-10], [5,0]],
//       [[5,0], [5,10]]
//     ]
// }

Keywords

geojson

FAQs

Package last updated on 02 Jun 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts