Skip to main content
Version: 7.1.0

lineIntersect

Description

Takes any LineString or Polygon GeoJSON and returns the intersecting point(s).

Parameters

NameTypeDescription
line1GeoJSONany LineString or Polygon
line2GeoJSONany LineString or Polygon
options?ObjectOptional parameters (default {})
options.removeDuplicates?booleanremove duplicate intersections (default true)
options.ignoreSelfIntersections?booleanignores self-intersections on input features (default false)

Returns

Examples

var line1 = turf.lineString([
[126, -11],
[129, -21],
]);
var line2 = turf.lineString([
[123, -18],
[131, -14],
]);
var intersects = turf.lineIntersect(line1, line2);

Installation

$ npm install @turf/line-intersect

import { lineIntersect } from "@turf/line-intersect";
const result = lineIntersect(...);
$ npm install @turf/turf

import * as turf from "@turf/turf";
const result = turf.lineIntersect(...);