booleanIntersects
描述
🌐 Description
如果两个几何体的交集不为空集,则 Boolean-intersects 返回 (TRUE)。
🌐 Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.
参数
🌐 Parameters
| 名称 | 类型 | 描述 |
|---|---|---|
| feature1 | Geometry | Feature<any> | GeoJSON 特性或几何 |
| feature2 | Geometry | Feature<any> | GeoJSON 特性或几何 |
| options? | Object | 可选参数 (默认 {}) |
| options.ignoreSelfIntersections? | boolean | 忽略输入特性上的自相交 (默认 true) |
返回
🌐 Returns
boolean 如果几何图形相交则为真,否则为假
示例
🌐 Examples
var point1 = turf.point([2, 2]);
var point2 = turf.point([1, 2]);
var line = turf.lineString([
[1, 1],
[1, 3],
[1, 4],
]);
turf.booleanIntersects(line, point1);
//=false
turf.booleanIntersects(line, point2);
//=true
安装
🌐 Installation
$ npm install @turf/boolean-intersects
import { booleanIntersects } from "@turf/boolean-intersects";
const result = booleanIntersects(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.booleanIntersects(...);