From c1b64933736c29a6258ab7a7bcfc7fbbfddf6714 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sun, 5 Apr 2020 16:15:55 +0200 Subject: [PATCH 1/4] adapt municipality and region for Germany --- settings/address-levels.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/settings/address-levels.json b/settings/address-levels.json index 10cbf307..fe2b2eaa 100644 --- a/settings/address-levels.json +++ b/settings/address-levels.json @@ -94,7 +94,9 @@ { "countries" : [ "de" ], "tags" : { "place" : { - "county" : [12, 0] + "region" : [10, 0], + "county" : [12, 0], + "municipality" : 14 }, "boundary" : { "administrative5" : [10, 0] From af6b9fdb399f6f478ccfcd60f57ad223c7dc3cdf Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 25 Apr 2020 22:53:35 +0200 Subject: [PATCH 2/4] fix admin levels for Norway and Sweden Admin levels 3 and 4 are used for region and county respectively, so downgrade the ranking. --- settings/address-levels.json | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/settings/address-levels.json b/settings/address-levels.json index fe2b2eaa..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, @@ -95,8 +95,7 @@ "tags" : { "place" : { "region" : [10, 0], - "county" : [12, 0], - "municipality" : 14 + "county" : [12, 0] }, "boundary" : { "administrative5" : [10, 0] @@ -109,6 +108,16 @@ "administrative7" : [14, 0] } } +}, +{ "countries" : ["se", "no"], + "tags" : { + "place" : { + }, + "boundary" : { + "administrative3" : 8, + "administrative4" : 12 + } + } } ] From aa4bd006312e6a0acbd728dec9daa4f745741390 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 23 May 2020 16:19:27 +0200 Subject: [PATCH 3/4] Adapt boundary labels for Sweden and Norway This also gives us the correct labels for address output in json and xml. --- lib/ClassTypes.php | 10 +++++++++- test/php/Nominatim/ClassTypesTest.php | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) 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/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() From 8218da27b3574d8c748f44ae3e59b0132ff56d73 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Sat, 23 May 2020 19:40:41 +0200 Subject: [PATCH 4/4] adapt tests to new ranks --- test/bdd/db/import/placex.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 |