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:
Said Turksever authored and GitHub committed 2026-10-25 17:04:43 -07:00
1 parent ba292ce475
commit a43ff8619e
6 files changed
+50 -7

No files matched your search

+3 -1
View File
@@ -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}`;
}