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

@turf/boolean-crosses

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/boolean-crosses

turf boolean-crosses module

  • 5.1.5
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
684K
decreased by-16.05%
Maintainers
4
Weekly downloads
 
Created

What is @turf/boolean-crosses?

@turf/boolean-crosses is a module from the Turf.js library that provides geospatial analysis tools. This specific module is used to determine if two geometries (such as lines or polygons) cross each other. It is useful in various geospatial applications, such as GIS, mapping, and spatial data analysis.

What are @turf/boolean-crosses's main functionalities?

Check if LineString crosses another LineString

This feature allows you to check if one LineString crosses another LineString. In this example, two lines intersect each other, so the result is true.

const turf = require('@turf/turf');
const line1 = turf.lineString([[0, 0], [2, 2]]);
const line2 = turf.lineString([[0, 2], [2, 0]]);
const crosses = turf.booleanCrosses(line1, line2);
console.log(crosses); // true

Check if LineString crosses a Polygon

This feature allows you to check if a LineString crosses a Polygon. In this example, the line crosses the polygon, so the result is true.

const turf = require('@turf/turf');
const line = turf.lineString([[1, 1], [3, 3]]);
const polygon = turf.polygon([[[0, 0], [0, 4], [4, 4], [4, 0], [0, 0]]]);
const crosses = turf.booleanCrosses(line, polygon);
console.log(crosses); // true

Check if MultiLineString crosses a Polygon

This feature allows you to check if a MultiLineString crosses a Polygon. In this example, the multi-line string crosses the polygon, so the result is true.

const turf = require('@turf/turf');
const multiLine = turf.multiLineString([[[1, 1], [3, 3]], [[2, 2], [4, 4]]]);
const polygon = turf.polygon([[[0, 0], [0, 5], [5, 5], [5, 0], [0, 0]]]);
const crosses = turf.booleanCrosses(multiLine, polygon);
console.log(crosses); // true

Other packages similar to @turf/boolean-crosses

Keywords

FAQs

Package last updated on 10 Dec 2017

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