]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Wed, 27 May 2020 19:30:18 +0000 (21:30 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Wed, 27 May 2020 19:30:18 +0000 (21:30 +0200)
data-sources/wikipedia-wikidata/README.md
lib/AddressDetails.php
lib/ClassTypes.php
settings/address-levels.json
sql/functions/address_lookup.sql
test/bdd/db/import/placex.feature
test/php/Nominatim/ClassTypesTest.php

index 78a9a37444b66b98f851d9371d161f71ac9fdabe..f3165f53898bd8c7965929a86aeb06be14c903f9 100644 (file)
@@ -26,7 +26,7 @@ This step downloads and converts [Wikipedia](https://dumps.wikimedia.org/) page
 
 To download, convert, and import the data, then process summary statistics and compute importance scores, run:
 ```
-./wikipedia_import.sh
+./import_wikipedia.sh
 ```
 ---
 Wikidata
@@ -54,5 +54,5 @@ By including Wikidata in the wikipedia_articles table, new connections can be ma
 
 To download, convert, and import the data, then process required items, run:
 ``` 
-./wikidata_import.sh
+./import_wikidata.sh
 ```
index dd86707974765570ae9a1766eb8d29a06fb299e7..a27d3e797feefd123bbd11ab52c48a630ac14929 100644 (file)
@@ -117,8 +117,12 @@ class AddressDetails
 
             if ($aLine['type'] == 'postcode' || $aLine['type'] == 'postal_code') {
                 $aJson['postcode'] = $aLine['localname'];
-            } elseif ($aLine['type'] == 'house_number') {
+                continue;
+            }
+
+            if ($aLine['type'] == 'house_number') {
                 $aJson['housenumber'] = $aLine['localname'];
+                continue;
             }
 
             if ($this->iPlaceID == $aLine['place_id']) {
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 daed3a8b5e3d6dcbc7a41c744dca3b438e030533..7e8a9ecda967e95a22f5d1ff590767a6ca68c2c8 100644 (file)
@@ -207,7 +207,7 @@ BEGIN
 
   FOR location IN
     SELECT placex.place_id, osm_type, osm_id, name, class, type,
-           coalesce(extratags->'place', extratags->'linked_place') as place_type,
+           coalesce(extratags->'linked_place', extratags->'place') as place_type,
            admin_level, fromarea, isaddress and linked_place_id is NULL as isaddress,
            CASE WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
            distance, country_code, postcode
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()