lineIntersect
Description
Takes any LineString or Polygon GeoJSON and returns the intersecting point(s).
Parameters
Name | Type | Description |
---|---|---|
line1 | GeoJSON | any LineString or Polygon |
line2 | GeoJSON | any LineString or Polygon |
options? | Object | Optional parameters (default {}) |
options.removeDuplicates? | boolean | remove duplicate intersections (default true) |
options.ignoreSelfIntersections? | boolean | ignores self-intersections on input features (default false) |
Returns
FeatureCollection<Point> point(s) that intersect both
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(...);