Skip to content

KBE3D / KBCore / turf / booleanIntersects

函数: booleanIntersects()

booleanIntersects(feature1: Geometry | Feature<any, GeoJsonProperties>, feature2: Geometry | Feature<any, GeoJsonProperties>, options?: { ignoreSelfIntersections?: boolean; }): boolean

Function

Boolean-intersects returns (TRUE) if the intersection of the two geometries is NOT an empty set.

参数

feature1

GeoJSON Feature or Geometry

Geometry | Feature<any, GeoJsonProperties>

feature2

GeoJSON Feature or Geometry

Geometry | Feature<any, GeoJsonProperties>

options?

Optional parameters

ignoreSelfIntersections?

boolean

ignore self-intersections on input features

返回

boolean

true if geometries intersect, false otherwise

示例

ts
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

//addToMap
var addToMap = [point1, point2, line];
point1.properties['marker-color'] = '#f00'
point2.properties['marker-color'] = '#0f0'

KBE3D @3.0.0 Copyright © 2024-present KBE3D