Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@turf/line-slice

Package Overview
Dependencies
Maintainers
0
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/line-slice

turf line-slice module

  • 7.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
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

FAQs

Package last updated on 29 Dec 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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc