diff --git a/packages/turf-line-overlap/index.ts b/packages/turf-line-overlap/index.ts index 74d477a81..6b1d1f856 100644 --- a/packages/turf-line-overlap/index.ts +++ b/packages/turf-line-overlap/index.ts @@ -88,10 +88,10 @@ function lineOverlap< tolerance === 0 ? booleanPointOnLine(coordsSegment[0], match) && booleanPointOnLine(coordsSegment[1], match) - : nearestPointOnLine(match, coordsSegment[0]).properties.dist! <= - tolerance && - nearestPointOnLine(match, coordsSegment[1]).properties.dist! <= - tolerance + : nearestPointOnLine(match, coordsSegment[0]).properties + .pointDistance! <= tolerance && + nearestPointOnLine(match, coordsSegment[1]).properties + .pointDistance! <= tolerance ) { doesOverlaps = true; if (overlapSegment) { @@ -102,10 +102,10 @@ function lineOverlap< tolerance === 0 ? booleanPointOnLine(coordsMatch[0], segment) && booleanPointOnLine(coordsMatch[1], segment) - : nearestPointOnLine(segment, coordsMatch[0]).properties.dist! <= - tolerance && - nearestPointOnLine(segment, coordsMatch[1]).properties.dist! <= - tolerance + : nearestPointOnLine(segment, coordsMatch[0]).properties + .pointDistance! <= tolerance && + nearestPointOnLine(segment, coordsMatch[1]).properties + .pointDistance! <= tolerance ) { // Do not define (doesOverlap = true) since more matches can occur within the same segment // doesOverlaps = true; diff --git a/packages/turf-line-slice/index.ts b/packages/turf-line-slice/index.ts index 0c30b9673..6a50c7c92 100644 --- a/packages/turf-line-slice/index.ts +++ b/packages/turf-line-slice/index.ts @@ -45,13 +45,13 @@ function lineSlice( const startVertex = nearestPointOnLine(line, startPt); const stopVertex = nearestPointOnLine(line, stopPt); const ends = - startVertex.properties.index <= stopVertex.properties.index + startVertex.properties.segmentIndex <= stopVertex.properties.segmentIndex ? [startVertex, stopVertex] : [stopVertex, startVertex]; const clipCoords = [ends[0].geometry.coordinates]; for ( - let i = ends[0].properties.index + 1; - i < ends[1].properties.index + 1; + let i = ends[0].properties.segmentIndex + 1; + i < ends[1].properties.segmentIndex + 1; i++ ) { clipCoords.push(coords[i]); diff --git a/packages/turf-line-split/index.ts b/packages/turf-line-split/index.ts index 21d715de8..479fef810 100644 --- a/packages/turf-line-split/index.ts +++ b/packages/turf-line-split/index.ts @@ -239,7 +239,7 @@ function findClosestFeature( var closestDistance = Infinity; featureEach(lines, function (segment) { var pt = nearestPointOnLine(segment, point); - var dist = pt.properties.dist; + var dist = pt.properties.pointDistance; if (dist < closestDistance) { closestFeature = segment; closestDistance = dist; diff --git a/packages/turf-nearest-point-on-line/README.md b/packages/turf-nearest-point-on-line/README.md index b9e549963..c6aba3c0e 100644 --- a/packages/turf-nearest-point-on-line/README.md +++ b/packages/turf-nearest-point-on-line/README.md @@ -10,19 +10,6 @@ If any of the segments in the input line string are antipodal and therefore have an undefined arc, this function will instead return that the point lies on the line. -⚠️ We have begun the process of migrating to different return properties for -this function. The new properties we recommend using as of v7.4 are: - -* lineStringIndex - point was found on the nth LineString of an input MultiLineString. Previously `multiFeatureIndex` -* segmentIndex - point was found on the nth segment of the above LineString. Previously `index` -* totalDistance - distance from the start of the overall MultiLineString. Previously `location` -* lineDistance - distance from the start of the relevant LineString -* segmentDistance - distance from the start of the relevant segment -* pointDistance - distance between found point is from input reference point. Previously `dist` - -multiFeatureIndex, index, location, and dist continue to work as previously -until at least the next major release. - ### Parameters * `lines` **([Geometry][1] | [Feature][2]<([LineString][3] | [MultiLineString][4])>)** Lines to snap to diff --git a/packages/turf-nearest-point-on-line/index.ts b/packages/turf-nearest-point-on-line/index.ts index 95307d23c..78196d817 100644 --- a/packages/turf-nearest-point-on-line/index.ts +++ b/packages/turf-nearest-point-on-line/index.ts @@ -17,18 +17,6 @@ import { getCoord, getCoords } from "@turf/invariant"; * have an undefined arc, this function will instead return that the point lies * on the line. * - * ⚠️ We have begun the process of migrating to different return properties for - * this function. The new properties we recommend using as of v7.4 are: - * - lineStringIndex - point was found on the nth LineString of an input MultiLineString. Previously `multiFeatureIndex` - * - segmentIndex - point was found on the nth segment of the above LineString. Previously `index` - * - totalDistance - distance from the start of the overall MultiLineString. Previously `location` - * - lineDistance - distance from the start of the relevant LineString - * - segmentDistance - distance from the start of the relevant segment - * - pointDistance - distance between found point is from input reference point. Previously `dist` - * - * multiFeatureIndex, index, location, and dist continue to work as previously - * until at least the next major release. - * * @function * @param {Geometry|Feature} lines Lines to snap to * @param {Geometry|Feature|number[]} inputPoint Point to snap from @@ -65,10 +53,6 @@ function nearestPointOnLine( lineDistance: number; segmentDistance: number; pointDistance: number; - multiFeatureIndex: number; - index: number; - location: number; - dist: number; [key: string]: any; } > { @@ -85,12 +69,6 @@ function nearestPointOnLine( lineDistance: -1, segmentDistance: -1, pointDistance: Infinity, - // deprecated properties START - multiFeatureIndex: -1, - index: -1, - location: -1, - dist: Infinity, - // deprecated properties END }); let totalDistance = 0.0; @@ -153,21 +131,7 @@ function nearestPointOnLine( lineDistance: lineDistance + segmentDistance, segmentDistance: segmentDistance, pointDistance: pointDistance, - // deprecated properties START - multiFeatureIndex: -1, - index: -1, - location: -1, - dist: Infinity, - // deprecated properties END }); - closestPt.properties = { - ...closestPt.properties, - multiFeatureIndex: closestPt.properties.lineStringIndex, - index: closestPt.properties.segmentIndex, - location: closestPt.properties.totalDistance, - dist: closestPt.properties.pointDistance, - // deprecated properties END - }; } // update totalDistance and lineDistance diff --git a/packages/turf-nearest-point-on-line/test.ts b/packages/turf-nearest-point-on-line/test.ts index 5ca076096..91d6a438d 100644 --- a/packages/turf-nearest-point-on-line/test.ts +++ b/packages/turf-nearest-point-on-line/test.ts @@ -46,10 +46,6 @@ test("turf-nearest-point-on-line", (t) => { 6 ); onLine.properties.pointDistance = round(onLine.properties.pointDistance, 6); - // deprecated properties START - onLine.properties.dist = round(onLine.properties.dist, 6); - onLine.properties.location = round(onLine.properties.location, 6); - // deprecated properties END onLine.properties["marker-color"] = "#F0F"; const between = lineString( [onLine.geometry.coordinates, point.geometry.coordinates], diff --git a/packages/turf-nearest-point-on-line/test/out/end-point-1.geojson b/packages/turf-nearest-point-on-line/test/out/end-point-1.geojson index b453251c4..ec28fa7d1 100644 --- a/packages/turf-nearest-point-on-line/test/out/end-point-1.geojson +++ b/packages/turf-nearest-point-on-line/test/out/end-point-1.geojson @@ -35,10 +35,6 @@ { "type": "Feature", "properties": { - "dist": 0.373652, - "location": 3.505821, - "index": 2, - "multiFeatureIndex": 0, "lineStringIndex": 0, "segmentIndex": 2, "totalDistance": 3.505821, diff --git a/packages/turf-nearest-point-on-line/test/out/end-point-2.geojson b/packages/turf-nearest-point-on-line/test/out/end-point-2.geojson index 4f4f0fd4f..6e2d66a7e 100644 --- a/packages/turf-nearest-point-on-line/test/out/end-point-2.geojson +++ b/packages/turf-nearest-point-on-line/test/out/end-point-2.geojson @@ -34,10 +34,6 @@ { "type": "Feature", "properties": { - "dist": 0.373652, - "location": 3.505821, - "index": 1, - "multiFeatureIndex": 0, "lineStringIndex": 0, "segmentIndex": 1, "totalDistance": 3.505821, diff --git a/packages/turf-nearest-point-on-line/test/out/line-northern-latitude-#344.geojson b/packages/turf-nearest-point-on-line/test/out/line-northern-latitude-#344.geojson index 10518c5c4..6f9fda484 100644 --- a/packages/turf-nearest-point-on-line/test/out/line-northern-latitude-#344.geojson +++ b/packages/turf-nearest-point-on-line/test/out/line-northern-latitude-#344.geojson @@ -45,10 +45,6 @@ "lineDistance": 19.748879, "segmentDistance": 1.771897, "pointDistance": 5.959562, - "dist": 5.959562, - "multiFeatureIndex": 0, - "location": 19.748879, - "index": 1, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-nearest-point-on-line/test/out/line1.geojson b/packages/turf-nearest-point-on-line/test/out/line1.geojson index 0d9976412..5cd298531 100644 --- a/packages/turf-nearest-point-on-line/test/out/line1.geojson +++ b/packages/turf-nearest-point-on-line/test/out/line1.geojson @@ -45,10 +45,6 @@ "lineDistance": 22.137494, "segmentDistance": 3.445915, "pointDistance": 2.556271, - "dist": 2.556271, - "multiFeatureIndex": 0, - "location": 22.137494, - "index": 1, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-nearest-point-on-line/test/out/multiLine1.geojson b/packages/turf-nearest-point-on-line/test/out/multiLine1.geojson index c593b2127..fcf5d3bb8 100644 --- a/packages/turf-nearest-point-on-line/test/out/multiLine1.geojson +++ b/packages/turf-nearest-point-on-line/test/out/multiLine1.geojson @@ -73,10 +73,6 @@ "lineDistance": 4800.716022, "segmentDistance": 173.221741, "pointDistance": 114.725451, - "dist": 114.725451, - "multiFeatureIndex": 1, - "location": 9479.011715, - "index": 20, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-nearest-point-on-line/test/out/multiLine2.geojson b/packages/turf-nearest-point-on-line/test/out/multiLine2.geojson index 33d69b037..d6f1dab2c 100644 --- a/packages/turf-nearest-point-on-line/test/out/multiLine2.geojson +++ b/packages/turf-nearest-point-on-line/test/out/multiLine2.geojson @@ -54,10 +54,6 @@ "lineDistance": 0, "segmentDistance": 0, "pointDistance": 390.942725, - "dist": 390.942725, - "multiFeatureIndex": 1, - "location": 1656.139708, - "index": 0, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-nearest-point-on-line/test/out/multiLine3.geojson b/packages/turf-nearest-point-on-line/test/out/multiLine3.geojson index 60de5cb7b..e5e78b928 100644 --- a/packages/turf-nearest-point-on-line/test/out/multiLine3.geojson +++ b/packages/turf-nearest-point-on-line/test/out/multiLine3.geojson @@ -63,10 +63,6 @@ "lineDistance": 214.735285, "segmentDistance": 214.735285, "pointDistance": 121.937841, - "dist": 121.937841, - "multiFeatureIndex": 0, - "location": 214.735285, - "index": 0, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-nearest-point-on-line/test/out/route1.geojson b/packages/turf-nearest-point-on-line/test/out/route1.geojson index cafeca72c..109573731 100644 --- a/packages/turf-nearest-point-on-line/test/out/route1.geojson +++ b/packages/turf-nearest-point-on-line/test/out/route1.geojson @@ -4798,10 +4798,6 @@ "lineDistance": 183.46844, "segmentDistance": 0.044741, "pointDistance": 7.876557, - "dist": 7.876557, - "multiFeatureIndex": 0, - "location": 183.46844, - "index": 3104, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-nearest-point-on-line/test/out/route2.geojson b/packages/turf-nearest-point-on-line/test/out/route2.geojson index c2cc1bb96..7e627fd54 100644 --- a/packages/turf-nearest-point-on-line/test/out/route2.geojson +++ b/packages/turf-nearest-point-on-line/test/out/route2.geojson @@ -3802,10 +3802,6 @@ "lineDistance": 303.639629, "segmentDistance": 0.867249, "pointDistance": 19.22738, - "dist": 19.22738, - "multiFeatureIndex": 0, - "location": 303.639629, - "index": 1185, "marker-color": "#F0F" }, "geometry": { diff --git a/packages/turf-point-to-line-distance/index.ts b/packages/turf-point-to-line-distance/index.ts index 9defac1f5..8ac02f030 100644 --- a/packages/turf-point-to-line-distance/index.ts +++ b/packages/turf-point-to-line-distance/index.ts @@ -108,7 +108,7 @@ function distanceToSegment( const nearest = nearestPointOnLine(lineString([a, b]).geometry, p, { units: "degrees", }); - return nearest.properties.dist; + return nearest.properties.pointDistance; } // Perform scalar calculations instead using rhumb lines.