Skip to content

Commit 17e7ffc

Browse files
committed
remove deprecated properties in nearest-point-on-line
1 parent 5721ddd commit 17e7ffc

File tree

12 files changed

+0
-89
lines changed

12 files changed

+0
-89
lines changed

packages/turf-nearest-point-on-line/README.md

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,6 @@ If any of the segments in the input line string are antipodal and therefore
1010
have an undefined arc, this function will instead return that the point lies
1111
on the line.
1212

13-
⚠️ We have begun the process of migrating to different return properties for
14-
this function. The new properties we recommend using as of v7.4 are:
15-
16-
* lineStringIndex - point was found on the nth LineString of an input MultiLineString. Previously `multiFeatureIndex`
17-
* segmentIndex - point was found on the nth segment of the above LineString. Previously `index`
18-
* totalDistance - distance from the start of the overall MultiLineString. Previously `location`
19-
* lineDistance - distance from the start of the relevant LineString
20-
* segmentDistance - distance from the start of the relevant segment
21-
* pointDistance - distance between found point is from input reference point. Previously `dist`
22-
23-
multiFeatureIndex, index, location, and dist continue to work as previously
24-
until at least the next major release.
25-
2613
### Parameters
2714

2815
* `lines` **([Geometry][1] | [Feature][2]<([LineString][3] | [MultiLineString][4])>)** Lines to snap to

packages/turf-nearest-point-on-line/index.ts

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,6 @@ import { getCoord, getCoords } from "@turf/invariant";
1717
* have an undefined arc, this function will instead return that the point lies
1818
* on the line.
1919
*
20-
* ⚠️ We have begun the process of migrating to different return properties for
21-
* this function. The new properties we recommend using as of v7.4 are:
22-
* - lineStringIndex - point was found on the nth LineString of an input MultiLineString. Previously `multiFeatureIndex`
23-
* - segmentIndex - point was found on the nth segment of the above LineString. Previously `index`
24-
* - totalDistance - distance from the start of the overall MultiLineString. Previously `location`
25-
* - lineDistance - distance from the start of the relevant LineString
26-
* - segmentDistance - distance from the start of the relevant segment
27-
* - pointDistance - distance between found point is from input reference point. Previously `dist`
28-
*
29-
* multiFeatureIndex, index, location, and dist continue to work as previously
30-
* until at least the next major release.
31-
*
3220
* @function
3321
* @param {Geometry|Feature<LineString|MultiLineString>} lines Lines to snap to
3422
* @param {Geometry|Feature<Point>|number[]} inputPoint Point to snap from
@@ -65,10 +53,6 @@ function nearestPointOnLine<G extends LineString | MultiLineString>(
6553
lineDistance: number;
6654
segmentDistance: number;
6755
pointDistance: number;
68-
multiFeatureIndex: number;
69-
index: number;
70-
location: number;
71-
dist: number;
7256
[key: string]: any;
7357
}
7458
> {
@@ -85,12 +69,6 @@ function nearestPointOnLine<G extends LineString | MultiLineString>(
8569
lineDistance: -1,
8670
segmentDistance: -1,
8771
pointDistance: Infinity,
88-
// deprecated properties START
89-
multiFeatureIndex: -1,
90-
index: -1,
91-
location: -1,
92-
dist: Infinity,
93-
// deprecated properties END
9472
});
9573

9674
let totalDistance = 0.0;
@@ -153,21 +131,7 @@ function nearestPointOnLine<G extends LineString | MultiLineString>(
153131
lineDistance: lineDistance + segmentDistance,
154132
segmentDistance: segmentDistance,
155133
pointDistance: pointDistance,
156-
// deprecated properties START
157-
multiFeatureIndex: -1,
158-
index: -1,
159-
location: -1,
160-
dist: Infinity,
161-
// deprecated properties END
162134
});
163-
closestPt.properties = {
164-
...closestPt.properties,
165-
multiFeatureIndex: closestPt.properties.lineStringIndex,
166-
index: closestPt.properties.segmentIndex,
167-
location: closestPt.properties.totalDistance,
168-
dist: closestPt.properties.pointDistance,
169-
// deprecated properties END
170-
};
171135
}
172136

173137
// update totalDistance and lineDistance

packages/turf-nearest-point-on-line/test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ test("turf-nearest-point-on-line", (t) => {
4646
6
4747
);
4848
onLine.properties.pointDistance = round(onLine.properties.pointDistance, 6);
49-
// deprecated properties START
50-
onLine.properties.dist = round(onLine.properties.dist, 6);
51-
onLine.properties.location = round(onLine.properties.location, 6);
52-
// deprecated properties END
5349
onLine.properties["marker-color"] = "#F0F";
5450
const between = lineString(
5551
[onLine.geometry.coordinates, point.geometry.coordinates],

packages/turf-nearest-point-on-line/test/out/end-point-1.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,6 @@
3535
{
3636
"type": "Feature",
3737
"properties": {
38-
"dist": 0.373652,
39-
"location": 3.505821,
40-
"index": 2,
41-
"multiFeatureIndex": 0,
4238
"lineStringIndex": 0,
4339
"segmentIndex": 2,
4440
"totalDistance": 3.505821,

packages/turf-nearest-point-on-line/test/out/end-point-2.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@
3434
{
3535
"type": "Feature",
3636
"properties": {
37-
"dist": 0.373652,
38-
"location": 3.505821,
39-
"index": 1,
40-
"multiFeatureIndex": 0,
4137
"lineStringIndex": 0,
4238
"segmentIndex": 1,
4339
"totalDistance": 3.505821,

packages/turf-nearest-point-on-line/test/out/line-northern-latitude-#344.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
"lineDistance": 19.748879,
4646
"segmentDistance": 1.771897,
4747
"pointDistance": 5.959562,
48-
"dist": 5.959562,
49-
"multiFeatureIndex": 0,
50-
"location": 19.748879,
51-
"index": 1,
5248
"marker-color": "#F0F"
5349
},
5450
"geometry": {

packages/turf-nearest-point-on-line/test/out/line1.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,6 @@
4545
"lineDistance": 22.137494,
4646
"segmentDistance": 3.445915,
4747
"pointDistance": 2.556271,
48-
"dist": 2.556271,
49-
"multiFeatureIndex": 0,
50-
"location": 22.137494,
51-
"index": 1,
5248
"marker-color": "#F0F"
5349
},
5450
"geometry": {

packages/turf-nearest-point-on-line/test/out/multiLine1.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,6 @@
7373
"lineDistance": 4800.716022,
7474
"segmentDistance": 173.221741,
7575
"pointDistance": 114.725451,
76-
"dist": 114.725451,
77-
"multiFeatureIndex": 1,
78-
"location": 9479.011715,
79-
"index": 20,
8076
"marker-color": "#F0F"
8177
},
8278
"geometry": {

packages/turf-nearest-point-on-line/test/out/multiLine2.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,6 @@
5454
"lineDistance": 0,
5555
"segmentDistance": 0,
5656
"pointDistance": 390.942725,
57-
"dist": 390.942725,
58-
"multiFeatureIndex": 1,
59-
"location": 1656.139708,
60-
"index": 0,
6157
"marker-color": "#F0F"
6258
},
6359
"geometry": {

packages/turf-nearest-point-on-line/test/out/multiLine3.geojson

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,6 @@
6363
"lineDistance": 214.735285,
6464
"segmentDistance": 214.735285,
6565
"pointDistance": 121.937841,
66-
"dist": 121.937841,
67-
"multiFeatureIndex": 0,
68-
"location": 214.735285,
69-
"index": 0,
7066
"marker-color": "#F0F"
7167
},
7268
"geometry": {

0 commit comments

Comments
 (0)