From 3af152046124403d0feaa32f9c02e23bba97c66b Mon Sep 17 00:00:00 2001 From: marc tobias Date: Mon, 5 Aug 2019 23:32:46 +0200 Subject: [PATCH] lookup endpoint returns boundingbox --- test/bdd/api/lookup/simple.feature | 13 +++++++++++++ website/lookup.php | 12 ++++++++++++ 2 files changed, 25 insertions(+) diff --git a/test/bdd/api/lookup/simple.feature b/test/bdd/api/lookup/simple.feature index dc80c235..53b222a0 100644 --- a/test/bdd/api/lookup/simple.feature +++ b/test/bdd/api/lookup/simple.feature @@ -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 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 | diff --git a/website/lookup.php b/website/lookup.php index e5f01232..39a17ebd 100644 --- a/website/lookup.php +++ b/website/lookup.php @@ -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; } }