Skip to content

Commit c4b13f2

Browse files
committed
add support for lookup of linked places
1 parent 7a2e586 commit c4b13f2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

lib-php/PlaceLookup.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,12 +187,12 @@ public function lookupOSMID($sType, $iID)
187187
return null;
188188
}
189189

190-
$aResults = $this->lookup(array($iPlaceID => new Result($iPlaceID)));
190+
$aResults = $this->lookup(array($iPlaceID => new Result($iPlaceID)), 0, 30, true);
191191

192192
return empty($aResults) ? null : reset($aResults);
193193
}
194194

195-
public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30)
195+
public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30, $bAllowLinked = false)
196196
{
197197
Debug::newFunction('Place lookup');
198198

@@ -247,7 +247,9 @@ public function lookup($aResults, $iMinRank = 0, $iMaxRank = 30)
247247
if ($this->sAllowedTypesSQLList) {
248248
$sSQL .= 'AND placex.class in '.$this->sAllowedTypesSQLList;
249249
}
250-
$sSQL .= ' AND linked_place_id is null ';
250+
if (!$bAllowLinked) {
251+
$sSQL .= ' AND linked_place_id is null ';
252+
}
251253
$sSQL .= ' GROUP BY ';
252254
$sSQL .= ' osm_type, ';
253255
$sSQL .= ' osm_id, ';

test/bdd/api/lookup/simple.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,11 @@ Feature: Places by osm_type and osm_id Tests
3131
| jsonv2 |
3232
| geojson |
3333
| xml |
34+
35+
36+
Scenario: Lookup of a linked place
37+
When sending geocodejson lookup query for N1932181216
38+
Then exactly 1 result is returned
39+
And results contain
40+
| name |
41+
| Vaduz |

0 commit comments

Comments
 (0)