New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@turf/line-slice-along

Package Overview
Dependencies
Maintainers
6
Versions
55
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/line-slice-along

turf line-slice-along module

6.2.0
Source
npm
Version published
Maintainers
6
Created

What is @turf/line-slice-along?

@turf/line-slice-along is a module from the Turf.js library that allows you to slice a line segment from a given GeoJSON LineString based on start and stop distances along the line. This is useful for various geospatial operations where you need to extract a specific segment of a line based on distance measurements.

What are @turf/line-slice-along's main functionalities?

Slice a LineString

This feature allows you to slice a segment from a LineString based on start and stop distances. The code sample demonstrates how to use the `lineSliceAlong` function to extract a segment from a given LineString.

const turf = require('@turf/turf');

const line = turf.lineString([
  [-77.031669, 38.878605],
  [-77.029609, 38.881946],
  [-77.020339, 38.884084],
  [-77.025661, 38.885821],
  [-77.021884, 38.889563],
  [-77.019824, 38.892368]
]);

const start = 0.5; // start distance in kilometers
const stop = 2.5; // stop distance in kilometers

const slicedLine = turf.lineSliceAlong(line, start, stop);
console.log(JSON.stringify(slicedLine));

Other packages similar to @turf/line-slice-along

Keywords

turf

FAQs

Package last updated on 12 Jan 2021

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