Skip to content

KBE3D / KBCore / turf / lineOverlap

函数: lineOverlap()

lineOverlap<G1, G2>(line1: G1 | Feature<G1, GeoJsonProperties>, line2: G2 | Feature<G2, GeoJsonProperties>, options?: { tolerance?: number; }): FeatureCollection<LineString>

Function

Takes any LineString or Polygon and returns the overlapping lines between both features.

类型参数

G1

G1 extends LineString | MultiLineString | Polygon | MultiPolygon

G2

G2 extends LineString | MultiLineString | Polygon | MultiPolygon

参数

line1

any LineString or Polygon

G1 | Feature<G1, GeoJsonProperties>

line2

any LineString or Polygon

G2 | Feature<G2, GeoJsonProperties>

options?

Optional parameters

tolerance?

number

Tolerance distance to match overlapping line segments (in kilometers)

返回

FeatureCollection<LineString>

lines(s) that are overlapping between both features

示例

ts
var line1 = turf.lineString([[115, -35], [125, -30], [135, -30], [145, -35]]);
var line2 = turf.lineString([[115, -25], [125, -30], [135, -30], [145, -25]]);

var overlapping = turf.lineOverlap(line1, line2);

//addToMap
var addToMap = [line1, line2, overlapping]

KBE3D @3.0.0 Copyright © 2024-present KBE3D