]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge pull request #1804 from lonvia/ranking-improvement-germany
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 27 May 2020 09:58:21 +0000 (11:58 +0200)
committerGitHub <noreply@github.com>
Wed, 27 May 2020 09:58:21 +0000 (11:58 +0200)
Localized ranking adaptions for Germany, Sweden and Norway

lib/ClassTypes.php
settings/address-levels.json
test/bdd/db/import/placex.feature
test/php/Nominatim/ClassTypesTest.php

index 5a69d1ded8e9db631108ab9e09b9072d678d4d6a..4077d211bc94a211420838ac892cc7bcc4b6e21a 100644 (file)
@@ -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])
index 10cbf307464f46aeb0ef255614e8afedeeafc27b..8b25fb1a48da6d3a5ef15d8aff1ba58d1cc82c67 100644 (file)
@@ -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" : {
           "administrative7" : [14, 0]
       }
   }
+},
+{ "countries" : ["se", "no"],
+  "tags" : {
+      "place" : {
+      },
+      "boundary" : {
+          "administrative3" : 8,
+          "administrative4" : 12
+      }
+  }
 }
 ]
 
index c9583c8303950c95b4b97b74273997b1f7717120..07bb429526077275fb2e75452bedd5caf78cb500 100644 (file)
@@ -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 |
index 324acddecc7e1228f2e9f6b799b41642ff18c0dd..1ba79bdba282218c4aa448528a95294d27782485 100644 (file)
@@ -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()