X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/aa7c8b6b5bf40a950eabae8a040cd069bd045e39..8650e0fedd9a059170456c1af68a924d4a1f98e0:/lib/Geocode.php diff --git a/lib/Geocode.php b/lib/Geocode.php index 273fc0f0..7fa349ca 100644 --- a/lib/Geocode.php +++ b/lib/Geocode.php @@ -180,14 +180,15 @@ class Geocode { $this->aViewBox = array_map('floatval', $aViewbox); - if ($this->aViewBox[0] < -180 - || $this->aViewBox[2] > 180 - || $this->aViewBox[0] >= $this->aViewBox[2] - || $this->aViewBox[1] < -90 - || $this->aViewBox[3] > 90 - || $this->aViewBox[1] >= $this->aViewBox[3] + $this->aViewBox[0] = max(-180.0, min(180, $this->aViewBox[0])); + $this->aViewBox[1] = max(-90.0, min(90, $this->aViewBox[1])); + $this->aViewBox[2] = max(-180.0, min(180, $this->aViewBox[2])); + $this->aViewBox[3] = max(-90.0, min(90, $this->aViewBox[3])); + + if (abs($this->aViewBox[0] - $this->aViewBox[2]) < 0.000000001 + || abs($this->aViewBox[1] - $this->aViewBox[3]) < 0.000000001 ) { - userError("Bad parameter 'viewbox'. Out of range."); + userError("Bad parameter 'viewbox'. Not a box."); } $fHeight = $this->aViewBox[0] - $this->aViewBox[2];