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

@turf/line-slice

Package Overview
Dependencies
Maintainers
2
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/line-slice

# lineSlice

3.0.16
Source
npm
Version published
Weekly downloads
1.1M
12.55%
Maintainers
2
Weekly downloads
 
Created

What is @turf/line-slice?

@turf/line-slice is a module from the Turf.js library that allows you to extract a portion of a LineString between two points. This can be useful for various geospatial operations such as trimming routes, creating sub-paths, or analyzing specific segments of a path.

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

Extracting a LineString segment

This feature allows you to extract a segment of a LineString between two specified points. The code sample demonstrates how to create a LineString and then slice it between two points using the `lineSlice` function.

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 = turf.point([-77.029609, 38.881946]);
const stop = turf.point([-77.021884, 38.889563]);

const sliced = turf.lineSlice(start, stop, line);

console.log(JSON.stringify(sliced));

Other packages similar to @turf/line-slice

Keywords

turf

FAQs

Package last updated on 06 Jul 2016

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