Skip to content

Commit 2a110ae

Browse files
committed
turf-great-circle: Fix antipodal error message
1 parent 11ec0a8 commit 2a110ae

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

packages/turf-great-circle/lib/arc.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,9 @@ var GreatCircle = function (start, end, properties) {
135135
if (this.g === Math.PI) {
136136
throw new Error(
137137
"it appears " +
138-
start.view() +
138+
this.start.view() +
139139
" and " +
140-
end.view() +
140+
this.end.view() +
141141
" are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite"
142142
);
143143
} else if (isNaN(this.g)) {

packages/turf-great-circle/test.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,3 +59,16 @@ test("turf-great-circle with same input and output", (t) => {
5959

6060
t.end();
6161
});
62+
63+
test("turf-great-circle with antipodal start and end", (t) => {
64+
const start = point([0, 90]);
65+
const end = point([0, -90]);
66+
67+
t.throws(() => {
68+
greatCircle(start, end, {
69+
npoints: 4,
70+
});
71+
}, "it appears 0,90 and 0,-90 are 'antipodal', e.g diametrically opposite, thus there is no single route but rather infinite");
72+
73+
t.end();
74+
});

0 commit comments

Comments
 (0)