]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 22 Oct 2020 11:43:50 +0000 (13:43 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 22 Oct 2020 11:43:50 +0000 (13:43 +0200)
docs/develop/Ranking.md
lib/ClassTypes.php
lib/Geocode.php
module/CMakeLists.txt
osm2pgsql
settings/address-levels.json
vagrant/Install-on-Centos-7.sh
vagrant/Install-on-Centos-8.sh

index 278039db6c923c4ab4db46b64f70d75c61ef41e6..06f255004dcbc3b8cf272303da96880e3abc3c2a 100644 (file)
@@ -23,7 +23,7 @@ rank   | typical place types             | extent
 4      | countries                       | -
 5-9    | states, regions, provinces      | -
 10-12  | counties                        | -
-13-16  | cities, municipalities, islands | 7.5 km
+13-16  | cities, municipalities, islands | 15 km
 17-18  | towns, boroughs                 | 4 km
 19     | villages, suburbs               | 2 km
 20     | hamlets, farms, neighbourhoods  |  1 km
@@ -51,16 +51,24 @@ The following table gives an overview how ranks are mapped to address parts:
  10-12       | county
  13-16       | city
  17-21       | suburb
- 22-25       | neighbourhood
+ 22-24       | neighbourhood
+ 25          | squares, farms, localities
  26-27       | street
  28-30       | POI/house number
 
 The country rank 4 usually doesn't show up in the address parts of an object.
 The country is determined indirectly from the country code.
 
-Ranks 5-25 can be assigned more or less freely. They make up the major part
+Ranks 5-24 can be assigned more or less freely. They make up the major part
 of the address.
 
+Rank 25 is also an addressing rank but it is special because while it can be
+the parent to a POI with an addr:place of the same name, it cannot be a parent
+to streets. Use it for place features that are technically on the same level
+as a street (e.g. squares, city blocks) or for places that should not normally
+appear in an address unless explicitly tagged so (e.g place=locality which
+should be uninhabited and as such not addressable).
+
 The street ranks 26 and 27 are handled slightly differently. Only one object
 from these ranks shows up in an address.
 
index c8d37e5287d3097d429906ab832def1b96bbaf8f..752db86598d7ddc1aed422e7679b98736b4e1ca3 100644 (file)
@@ -275,6 +275,7 @@ function getImportance($aPlace)
 
     if ($aWithImportance === null) {
         $aWithImportance = array_flip(array(
+                                           'boundary:administrative',
                                            'place:country',
                                            'place:state',
                                            'place:province',
index 7ab53d97812a5cbf640672e93f0e963f8c6f10eb..8e71d761b367ce0d3e7722e6bf8adfd7f879b88b 100644 (file)
@@ -917,21 +917,14 @@ class Geocode
                     $aResult['lon'],
                     $aResult['lat']
                 );
-                // Adjust importance for the number of exact string matches in the result
-                $iCountWords = 0;
-                $sAddress = $aResult['langaddress'];
-                foreach ($aRecheckWords as $i => $sWord) {
-                    if (stripos($sAddress, $sWord)!==false) {
-                        $iCountWords++;
-                        if (preg_match('/(^|,)\s*'.preg_quote($sWord, '/').'\s*(,|$)/', $sAddress)) $iCountWords += 0.1;
-                    }
-                }
-
-                $aResult['importance'] = $aResult['importance'] + ($iCountWords*0.1); // 0.1 is a completely arbitrary number but something in the range 0.1 to 0.5 would seem right
 
                 // secondary ordering (for results with same importance (the smaller the better):
                 // - approximate importance of address parts
-                $aResult['foundorder'] = -$aResult['addressimportance']/10;
+                if (isset($aResult['addressimportance']) && $aResult['addressimportance']) {
+                    $aResult['foundorder'] = -$aResult['addressimportance']/10;
+                } else {
+                    $aResult['foundorder'] = -$aResult['importance'];
+                }
                 // - number of exact matches from the query
                 $aResult['foundorder'] -= $aResults[$aResult['place_id']]->iExactMatches;
                 // - importance of the class/type
@@ -941,6 +934,19 @@ class Geocode
                 } else {
                     $aResult['foundorder'] += 0.01;
                 }
+
+                // Adjust importance for the number of exact string matches in the result
+                $iCountWords = 0;
+                $sAddress = $aResult['langaddress'];
+                foreach ($aRecheckWords as $i => $sWord) {
+                    if (stripos($sAddress, $sWord)!==false) {
+                        $iCountWords++;
+                        if (preg_match('/(^|,)\s*'.preg_quote($sWord, '/').'\s*(,|$)/', $sAddress)) $iCountWords += 0.1;
+                    }
+                }
+
+                // 0.1 is a completely arbitrary number but something in the range 0.1 to 0.5 would seem right
+                $aResult['importance'] = $aResult['importance'] + ($iCountWords*0.1);
             }
             $aSearchResults[$iIdx] = $aResult;
         }
index 03beacb264a2bb5b6d6b0040335e8c7d15c317f2..6aef6a5acfb12ad4d9bfc3f664f55701c21ef266 100644 (file)
@@ -1,5 +1,14 @@
 # just use the pgxs makefile
-find_program(PG_CONFIG pg_config)
+
+foreach(suffix ${PostgreSQL_ADDITIONAL_VERSIONS} "13" "12" "11" "10" "9.6" "9.5" "9.4" "9.3")
+    list(APPEND PG_CONFIG_HINTS
+         "/usr/pgsql-${suffix}/bin")
+endforeach()
+
+find_program(PG_CONFIG pg_config HINTS ${PG_CONFIG_HINTS})
+
+
+
 execute_process(COMMAND ${PG_CONFIG} --pgxs
             OUTPUT_VARIABLE PGXS
             OUTPUT_STRIP_TRAILING_WHITESPACE)
index acbec68bbf94dafae103663801d55291cf8f227e..94a5060353179f4cf3e92aa622a2aa5d1afa6fee 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit acbec68bbf94dafae103663801d55291cf8f227e
+Subproject commit 94a5060353179f4cf3e92aa622a2aa5d1afa6fee
index 574e0dd041ef590fe3e100b1c7258d0f3743e655..1810af59755be89a1ed734594ad35cc51e895129 100644 (file)
           "province" : [8, 0],
           "region" : [18, 0],
           "county" : 12,
+          "district" : 12,
           "municipality" : 14,
           "city" : 16,
           "town" : [18, 16],
           "borough" : 18,
           "village" : [19, 16],
-          "district" : [19, 16],
           "suburb" : [19, 20],
           "hamlet" : 20,
           "croft" : 20,
-          "subdivision" : 20,
-          "allotments" : 20,
+          "subdivision" : 22,
+          "allotments" : 22,
           "neighbourhood" : [20, 22],
           "quarter" : [20, 22],
           "isolated_dwelling" : [22, 20],
-          "city_block" : 22,
-          "mountain_pass" : [20, 0],
+          "farm" : [22, 20],
+          "city_block" : 25,
+          "mountain_pass" : 25,
           "square" : 25,
+          "locality" : 25,
           "houses" : [28, 0],
-          "farm" : [20, 0],
-          "locality" : [20, 0],
           "house" : 30,
           "" : [22, 0]
       },
index 7ce09727c9dec9b14dac1b8513ef28d80997ced0..f26c567c8eaf4bcbe4a152120a1ed120a9a121e9 100755 (executable)
                         python3-pip python3-setuptools python3-devel \
                         expat-devel zlib-devel
 
-    # make sure pg_config gets found
-    echo 'PATH=/usr/pgsql-11/bin/:$PATH' >> ~/.bash_profile
-    source ~/.bash_profile
-
-    pip3 install --user psycopg2 pytidylib
+    pip3 install --user psycopg2
 
 
 #
index 75b7a558c8617be69cc4b0e2afd175c5f8693e8d..8fd983d35d568ca96b9180acf62730c4d20ca7b3 100755 (executable)
                         python3-pip python3-setuptools python3-devel \
                         expat-devel zlib-devel
 
-    # make sure pg_config gets found
-    echo 'PATH=/usr/pgsql-12/bin:$PATH' >> ~/.bash_profile
-    source ~/.bash_profile
-
-    pip3 install --user psycopg2 pytidylib
+    pip3 install --user psycopg2
 
 
 #