lineIntersect
描述
¥Description
Takes any LineString or Polygon GeoJSON and returns the intersecting point(s).
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
line1 | GeoJSON | 任意线串或多边形 |
line2 | GeoJSON | 任意线串或多边形 |
options? | 对象 | 可选参数(默认 ) |
options.removeDuplicates? | boolean | remove duplicate intersections (default true) |
options.ignoreSelfIntersections? | boolean | ignores self-intersections on input features (default true) |
返回
¥Returns
FeatureCollection<点> point(s) that intersect both
¥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(...);