From: Sarah Hoffmann Date: Wed, 27 May 2020 09:58:21 +0000 (+0200) Subject: Merge pull request #1804 from lonvia/ranking-improvement-germany X-Git-Tag: v3.5.0~6 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/5bebdfa434edd3c656cf8440b3ddbf55be6dcde8?hp=c43b39bd884df96dec11fed6f59016665c69a218 Merge pull request #1804 from lonvia/ranking-improvement-germany Localized ranking adaptions for Germany, Sweden and Norway --- diff --git a/lib/ClassTypes.php b/lib/ClassTypes.php index 5a69d1de..4077d211 100644 --- a/lib/ClassTypes.php +++ b/lib/ClassTypes.php @@ -85,7 +85,15 @@ function getBoundaryLabel($iAdminLevel, $sCountry, $sFallback = 'Administrative' 9 => 'City District', 10 => 'Suburb', 11 => 'Neighbourhood' - ) + ), + 'no' => array ( + 3 => 'State', + 4 => 'County' + ), + 'se' => array ( + 3 => 'State', + 4 => 'County' + ) ); if (isset($aBoundaryList[$sCountry]) diff --git a/settings/address-levels.json b/settings/address-levels.json index 10cbf307..8b25fb1a 100644 --- a/settings/address-levels.json +++ b/settings/address-levels.json @@ -8,11 +8,11 @@ "province" : [8, 0], "region" : [18, 0], "county" : 12, + "municipality" : [17, 14], "city" : 16, "island" : [17, 0], "town" : [18, 16], "village" : [19, 16], - "municipality" : [19, 16], "district" : [19, 16], "borough" : [19, 18], "hamlet" : 20, @@ -94,6 +94,7 @@ { "countries" : [ "de" ], "tags" : { "place" : { + "region" : [10, 0], "county" : [12, 0] }, "boundary" : { @@ -107,6 +108,16 @@ "administrative7" : [14, 0] } } +}, +{ "countries" : ["se", "no"], + "tags" : { + "place" : { + }, + "boundary" : { + "administrative3" : 8, + "administrative4" : 12 + } + } } ] diff --git a/test/bdd/db/import/placex.feature b/test/bdd/db/import/placex.feature index c9583c83..07bb4295 100644 --- a/test/bdd/db/import/placex.feature +++ b/test/bdd/db/import/placex.feature @@ -175,7 +175,7 @@ Feature: Import into placex | N20 | 18 | 16 | | N21 | 19 | 16 | | N22 | 20 | 20 | - | N23 | 19 | 16 | + | N23 | 17 | 14 | | N24 | 19 | 16 | | N26 | 19 | 18 | | N27 | 20 | 20 | diff --git a/test/php/Nominatim/ClassTypesTest.php b/test/php/Nominatim/ClassTypesTest.php index 324acdde..1ba79bdb 100644 --- a/test/php/Nominatim/ClassTypesTest.php +++ b/test/php/Nominatim/ClassTypesTest.php @@ -61,6 +61,8 @@ class ClassTypesTest extends \PHPUnit\Framework\TestCase $this->assertEquals('Administrative', ClassTypes\getBoundaryLabel(18, null)); $this->assertEquals('None', ClassTypes\getBoundaryLabel(18, null, 'None')); $this->assertEquals('State', ClassTypes\getBoundaryLabel(4, 'de', 'None')); + $this->assertEquals('County', ClassTypes\getBoundaryLabel(4, 'se', 'None')); + $this->assertEquals('Municipality', ClassTypes\getBoundaryLabel(7, 'se', 'None')); } public function testGetDefRadius()