Skip to main content
Version: 7.3.0

lineIntersect

描述

🌐 Description

获取任意 LineString 或 Polygon GeoJSON 对象并返回相交点。

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

参数

🌐 Parameters

名称类型描述
line1GeoJSON任意 LineString 或 Polygon
line2GeoJSON任意 LineString 或 Polygon
options?Object可选参数 (默认 {})
options.removeDuplicates?boolean移除重复交点 (默认 true)
options.ignoreSelfIntersections?boolean忽略输入要素的自相交 (默认 true)

返回

🌐 Returns

FeatureCollection<Point> 同时相交的点

示例

🌐 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(...);