]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #1453 from mtmail/add-boundingbox-to-lookup-results
authorSarah Hoffmann <lonvia@denofr.de>
Tue, 6 Aug 2019 18:40:06 +0000 (20:40 +0200)
committerGitHub <noreply@github.com>
Tue, 6 Aug 2019 18:40:06 +0000 (20:40 +0200)
lookup endpoint returns boundingbox

test/bdd/api/lookup/simple.feature
website/lookup.php

index dc80c2353aa407c042301229f2519bf9f5407972..53b222a00743c520b2b10e94670c352f266b8cd8 100644 (file)
@@ -18,3 +18,16 @@ Feature: Places by osm_type and osm_id Tests
     Scenario: address lookup for non-existing or invalid node, way, relation
         When sending xml lookup query for X99,,N0,nN158845944,ABC,,W9
         Then exactly 0 results are returned
+
+    Scenario Outline: Boundingbox is returned
+        When sending <format> lookup query for N3284625766,W6065798
+        Then exactly 2 results are returned
+        And result 0 has bounding box in -32.812,-32.811,-56.509,-56.508
+        And result 1 has bounding box in 47.14,47.15,9.51,9.53
+
+    Examples:
+      | format |
+      | json |
+      | jsonv2 |
+      | geojson |
+      | xml |
index e5f01232edf46dde05a56f144699080689705430..39a17ebdb693efd1706ee9f3f758d1b1c050f6db 100644 (file)
@@ -53,6 +53,18 @@ foreach ($aOsmIds as $sItem) {
                 unset($oResult['langaddress']);
                 $oResult['name'] = $oPlace['langaddress'];
             }
+
+            $aOutlineResult = $oPlaceLookup->getOutlines(
+                $oPlace['place_id'],
+                $oPlace['lon'],
+                $oPlace['lat'],
+                Nominatim\ClassTypes\getProperty($oPlace, 'defdiameter', 0.0001)
+            );
+
+            if ($aOutlineResult) {
+                $oResult = array_merge($oResult, $aOutlineResult);
+            }
+
             $aSearchResults[] = $oResult;
         }
     }