Skip to content

Commit 7b3afa1

Browse files
committed
Partial fix of geo search in full dezoom
1 parent 27fa7a1 commit 7b3afa1

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

playgrounds/geo-javascript/setup/settings.json

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,4 @@
11
{
2-
"rankingRules": [
3-
"words",
4-
"typo",
5-
"proximity",
6-
"attribute",
7-
"sort",
8-
"exactness"
9-
],
102
"filterableAttributes": [
113
"_geo"
124
],

src/utils/geographic.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,13 @@ export function middleGeoPoints(
5151
let lng3 = Math.atan2(y, x)
5252
let lat3 = Math.atan2(z, Hyp)
5353

54-
lat3 = rad2degr(lat3)
55-
lng3 = rad2degr(lng3)
54+
if (lng1 < lng2 || (lng1 > lng2 && lng1 > Math.PI && lng2 < -Math.PI)) {
55+
lat3 = lat3 + Math.PI
56+
lng3 = lng3 + Math.PI
57+
} else {
58+
lat3 = rad2degr(lat3)
59+
lng3 = rad2degr(lng3)
60+
}
5661

5762
if (
5863
Math.abs(x) < Math.pow(10, -9) &&

0 commit comments

Comments
 (0)