mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 03:14:00 +00:00
fix(search): normalize geocoder bias across the antimeridian (#1272)
Keep geocoder viewport bias near the antimeridian and omit misleading wrapped viewboxes. Contribution by @asturksever.
This commit is contained in:
1 parent
ba292ce475
commit
a43ff8619e
6 files changed
+50
-7
No files matched your search
@@ -166,6 +166,8 @@ export function nominatimViewboxFromBounds(bounds) {
|
||||
const neLat = nominatimLatitude(match[3]);
|
||||
const neLng = nominatimLongitude(match[4]);
|
||||
if ([swLat, swLng, neLat, neLng].some((value) => value === null)) return null;
|
||||
if (swLat >= neLat) return null;
|
||||
// One Nominatim viewbox cannot express a wrapped interval. Omit this soft
|
||||
// preference rather than biasing the search toward the opposite hemisphere.
|
||||
if (swLat >= neLat || swLng > neLng) return null;
|
||||
return `${swLng},${neLat},${neLng},${swLat}`;
|
||||
}
|
||||
Reference in new issue
Block a user