From: Sarah Hoffmann Date: Thu, 6 Dec 2018 20:18:47 +0000 (+0100) Subject: traverse address list backwards when computing admin levels X-Git-Tag: v3.3.0~47 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/411f361fcb11824ca72dc61b85baeb32b91f474a traverse address list backwards when computing admin levels By starting with the lowest address level, when collecting administrative boundaries by level, there is a better chance to actually get the boundary when the capital of the administrative boundary is tagged with the level of the boundary as well. This is just a heuristics adaption to make the best out of the imprecise admin_level definition for place nodes. Fixes #1261. --- diff --git a/lib/AddressDetails.php b/lib/AddressDetails.php index e6501b57..618e10c9 100644 --- a/lib/AddressDetails.php +++ b/lib/AddressDetails.php @@ -103,7 +103,7 @@ class AddressDetails public function getAdminLevels() { $aAddress = array(); - foreach ($this->aAddressLines as $aLine) { + foreach (array_reverse($this->aAddressLines) as $aLine) { if (self::isAddress($aLine) && isset($aLine['admin_level']) && $aLine['admin_level'] < 15