Skip to content

Commit 528bda8

Browse files
committed
update nearestPointOnLine property names in lineOverlap, lineSlice, lineSplit and pointToLineDistance functions
1 parent 17e7ffc commit 528bda8

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

packages/turf-line-overlap/index.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,10 +88,10 @@ function lineOverlap<
8888
tolerance === 0
8989
? booleanPointOnLine(coordsSegment[0], match) &&
9090
booleanPointOnLine(coordsSegment[1], match)
91-
: nearestPointOnLine(match, coordsSegment[0]).properties.dist! <=
92-
tolerance &&
93-
nearestPointOnLine(match, coordsSegment[1]).properties.dist! <=
94-
tolerance
91+
: nearestPointOnLine(match, coordsSegment[0]).properties
92+
.pointDistance! <= tolerance &&
93+
nearestPointOnLine(match, coordsSegment[1]).properties
94+
.pointDistance! <= tolerance
9595
) {
9696
doesOverlaps = true;
9797
if (overlapSegment) {
@@ -102,10 +102,10 @@ function lineOverlap<
102102
tolerance === 0
103103
? booleanPointOnLine(coordsMatch[0], segment) &&
104104
booleanPointOnLine(coordsMatch[1], segment)
105-
: nearestPointOnLine(segment, coordsMatch[0]).properties.dist! <=
106-
tolerance &&
107-
nearestPointOnLine(segment, coordsMatch[1]).properties.dist! <=
108-
tolerance
105+
: nearestPointOnLine(segment, coordsMatch[0]).properties
106+
.pointDistance! <= tolerance &&
107+
nearestPointOnLine(segment, coordsMatch[1]).properties
108+
.pointDistance! <= tolerance
109109
) {
110110
// Do not define (doesOverlap = true) since more matches can occur within the same segment
111111
// doesOverlaps = true;

packages/turf-line-slice/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,13 +45,13 @@ function lineSlice(
4545
const startVertex = nearestPointOnLine(line, startPt);
4646
const stopVertex = nearestPointOnLine(line, stopPt);
4747
const ends =
48-
startVertex.properties.index <= stopVertex.properties.index
48+
startVertex.properties.segmentIndex <= stopVertex.properties.segmentIndex
4949
? [startVertex, stopVertex]
5050
: [stopVertex, startVertex];
5151
const clipCoords = [ends[0].geometry.coordinates];
5252
for (
53-
let i = ends[0].properties.index + 1;
54-
i < ends[1].properties.index + 1;
53+
let i = ends[0].properties.segmentIndex + 1;
54+
i < ends[1].properties.segmentIndex + 1;
5555
i++
5656
) {
5757
clipCoords.push(coords[i]);

packages/turf-line-split/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ function findClosestFeature(
239239
var closestDistance = Infinity;
240240
featureEach(lines, function (segment) {
241241
var pt = nearestPointOnLine(segment, point);
242-
var dist = pt.properties.dist;
242+
var dist = pt.properties.pointDistance;
243243
if (dist < closestDistance) {
244244
closestFeature = segment;
245245
closestDistance = dist;

packages/turf-point-to-line-distance/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function distanceToSegment(
108108
const nearest = nearestPointOnLine(lineString([a, b]).geometry, p, {
109109
units: "degrees",
110110
});
111-
return nearest.properties.dist;
111+
return nearest.properties.pointDistance;
112112
}
113113

114114
// Perform scalar calculations instead using rhumb lines.

0 commit comments

Comments
 (0)