From: Sarah Hoffmann Date: Wed, 27 May 2020 19:30:18 +0000 (+0200) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~232 X-Git-Url: https://git.openstreetmap.org/nominatim.git/commitdiff_plain/c70b6ccc6dd6f69e371dbf0bc9c40126a9a65e75?hp=d3f7465ccad9cce6c84f0b089282c5ece550c5ed Merge remote-tracking branch 'upstream/master' --- diff --git a/data-sources/wikipedia-wikidata/README.md b/data-sources/wikipedia-wikidata/README.md index 78a9a374..f3165f53 100644 --- a/data-sources/wikipedia-wikidata/README.md +++ b/data-sources/wikipedia-wikidata/README.md @@ -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 ``` diff --git a/lib/AddressDetails.php b/lib/AddressDetails.php index dd867079..a27d3e79 100644 --- a/lib/AddressDetails.php +++ b/lib/AddressDetails.php @@ -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']) { 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/sql/functions/address_lookup.sql b/sql/functions/address_lookup.sql index daed3a8b..7e8a9ecd 100644 --- a/sql/functions/address_lookup.sql +++ b/sql/functions/address_lookup.sql @@ -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 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()