Socket
Socket
Sign inDemoInstall

@turf/intersect

Package Overview
Dependencies
Maintainers
4
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@turf/intersect

turf intersect module


Version published
Weekly downloads
530K
decreased by-5.78%
Maintainers
4
Weekly downloads
 
Created

What is @turf/intersect?

@turf/intersect is a module of the Turf.js library that provides geospatial analysis tools. Specifically, it allows users to compute the intersection of two or more geometries, such as polygons or lines. This is useful in various applications like geographic information systems (GIS), urban planning, and environmental modeling.

What are @turf/intersect's main functionalities?

Polygon Intersection

This feature allows you to find the intersection of two polygons. The code sample demonstrates how to create two polygons and compute their intersection.

const turf = require('@turf/turf');
const polygon1 = turf.polygon([[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]);
const polygon2 = turf.polygon([[[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]]);
const intersection = turf.intersect(polygon1, polygon2);
console.log(intersection);

Line Intersection

This feature allows you to find the intersection of two lines. The code sample demonstrates how to create two lines and compute their intersection.

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

MultiPolygon Intersection

This feature allows you to find the intersection of two multipolygons. The code sample demonstrates how to create two multipolygons and compute their intersection.

const turf = require('@turf/turf');
const multiPolygon1 = turf.multiPolygon([[[[0, 0], [2, 0], [2, 2], [0, 2], [0, 0]]]]);
const multiPolygon2 = turf.multiPolygon([[[[1, 1], [3, 1], [3, 3], [1, 3], [1, 1]]]]);
const intersection = turf.intersect(multiPolygon1, multiPolygon2);
console.log(intersection);

Other packages similar to @turf/intersect

Keywords

FAQs

Package last updated on 10 Apr 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