From 8d9b5e477538b6ca8339623f2643bc69e7be98f2 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 6 Aug 2023 17:47:47 +0200 Subject: [PATCH] allow oversized viewboxes again This seems to be a rather regular thing when unconditionally sending the current view and being zoomed out. Fixes #3137. --- nominatim/api/types.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/nominatim/api/types.py b/nominatim/api/types.py index 43e83c1f..a2a265c0 100644 --- a/nominatim/api/types.py +++ b/nominatim/api/types.py @@ -247,9 +247,10 @@ class Bbox: except ValueError as exc: raise UsageError('Bounding box parameter needs to be numbers.') from exc - if x1 < -180.0 or x1 > 180.0 or y1 < -90.0 or y1 > 90.0 \ - or x2 < -180.0 or x2 > 180.0 or y2 < -90.0 or y2 > 90.0: - raise UsageError('Bounding box coordinates invalid.') + x1 = min(180, max(-180, x1)) + x2 = min(180, max(-180, x2)) + y1 = min(90, max(-90, y1)) + y2 = min(90, max(-90, y2)) if x1 == x2 or y1 == y2: raise UsageError('Bounding box with invalid parameters.') -- 2.39.5