]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Sun, 18 May 2014 19:42:45 +0000 (21:42 +0200)
committerSarah Hoffmann <lonvia@denofr.de>
Sun, 18 May 2014 19:42:45 +0000 (21:42 +0200)
lib/PlaceLookup.php
lib/lib.php
osm2pgsql
sql/functions.sql
sql/partition-functions.src.sql
utils/setup.php

index ed2f494d45c41bbc66b3c2dc66a5012f158360c1..e00163378a3d48a8555864f4a8f1d75f1fec3b22 100644 (file)
                                {
                                        $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel'])?$aTypeLabel['simplelabel']:$aTypeLabel['label']);
                                        $sTypeLabel = str_replace(' ','_',$sTypeLabel);
-                                       if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel]))
+                                       if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel]) || $aLine['class'] == 'place')
                                        {
                                                $aAddress[$sTypeLabel] = $aLine['localname']?$aLine['localname']:$aLine['housenumber'];
                                        }
index 12f7e57e6eddb2217bceb51bd66a9102fdfe5dd8..b26038d8f2bcbd317875cabd01897287c0c08145 100644 (file)
                        {
                                $sTypeLabel = strtolower(isset($aTypeLabel['simplelabel'])?$aTypeLabel['simplelabel']:$aTypeLabel['label']);
                                $sTypeLabel = str_replace(' ','_',$sTypeLabel);
-                               if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel]))
+                               if (!isset($aAddress[$sTypeLabel]) || (isset($aFallback[$sTypeLabel]) && $aFallback[$sTypeLabel]) || $aLine['class'] == 'place')
                                {
                                        $aAddress[$sTypeLabel] = $aLine['localname']?$aLine['localname']:$aLine['housenumber'];
                                }
index 49089cb1a3c72ad97b57db21716a5fa07d4f2f8a..b59765e3ac591ff84f21f4a1153e7c18a2d2b855 160000 (submodule)
--- a/osm2pgsql
+++ b/osm2pgsql
@@ -1 +1 @@
-Subproject commit 49089cb1a3c72ad97b57db21716a5fa07d4f2f8a
+Subproject commit b59765e3ac591ff84f21f4a1153e7c18a2d2b855
index 9cf1bd40a690ca77d9983b19eea0bbf53a9196ee..a6fa20ea295be751f907848f663149d4b1e2b3ca 100644 (file)
@@ -2534,7 +2534,9 @@ BEGIN
   FOR location IN 
     select placex.place_id, osm_type, osm_id,
       CASE WHEN class = 'place' and type = 'postcode' THEN hstore('name', postcode) ELSE name END as name,
-      class, type, admin_level, fromarea, isaddress,
+      CASE WHEN extratags ? 'place' THEN 'place' ELSE class END as class,
+      CASE WHEN extratags ? 'place' THEN extratags->'place' ELSE type END as type,
+      admin_level, fromarea, isaddress,
       CASE WHEN address_place_id = for_place_id AND rank_address = 0 THEN 100 WHEN rank_address = 11 THEN 5 ELSE rank_address END as rank_address,
       distance,calculated_country_code,postcode
       from place_addressline join placex on (address_place_id = placex.place_id) 
index 8857e76646efdff3caf57e17ad9491db7e9cb90e..a0181c0a2680ba79195ec3e814dbabac8ededcca 100644 (file)
@@ -60,6 +60,9 @@ create or replace function insertLocationAreaLarge(
   in_centroid GEOMETRY, in_geometry GEOMETRY) RETURNS BOOLEAN AS $$
 DECLARE
 BEGIN
+  IF in_rank_address = 0 THEN
+    RETURN TRUE;
+  END IF;
 
   IF in_rank_search <= 4 THEN
     INSERT INTO location_area_country values (in_partition, in_place_id, in_country_code, in_keywords, in_rank_search, in_rank_address, in_estimate, in_centroid, in_geometry);
@@ -205,16 +208,20 @@ BEGIN
 
   IF in_rank_search <= 4 THEN
     DELETE FROM search_name_country WHERE place_id = in_place_id;
-    INSERT INTO search_name_country values (in_place_id, in_rank_search, in_rank_address, 
-      in_name_vector, in_geometry);
+    IF in_rank_address > 0 THEN
+      INSERT INTO search_name_country values (in_place_id, in_rank_search, in_rank_address,
+        in_name_vector, in_geometry);
+    END IF;
     RETURN TRUE;
   END IF;
 
 -- start
   IF in_partition = -partition- THEN
     DELETE FROM search_name_-partition- values WHERE place_id = in_place_id;
-    INSERT INTO search_name_-partition- values (in_place_id, in_rank_search, in_rank_address, 
-      in_name_vector, in_geometry);
+    IF in_rank_address > 0 THEN
+      INSERT INTO search_name_-partition- values (in_place_id, in_rank_search, in_rank_address,
+        in_name_vector, in_geometry);
+    END IF;
     RETURN TRUE;
   END IF;
 -- end
index edf0b14d460f27156569b65f872f2bb8aa934e6d..734f669f61082774181fe0014858ef064a5f830f 100755 (executable)
@@ -22,6 +22,7 @@
                array('create-functions', '', 0, 1, 0, 0, 'bool', 'Create functions'),
                array('enable-diff-updates', '', 0, 1, 0, 0, 'bool', 'Turn on the code required to make diff updates work'),
                array('enable-debug-statements', '', 0, 1, 0, 0, 'bool', 'Include debug warning statements in pgsql commands'),
+               array('ignore-errors', '', 0, 1, 0, 0, 'bool', 'Continue import even when errors in SQL are present (EXPERT)'),
                array('create-minimal-tables', '', 0, 1, 0, 0, 'bool', 'Create minimal main tables'),
                array('create-tables', '', 0, 1, 0, 0, 'bool', 'Create main tables'),
                array('create-partition-tables', '', 0, 1, 0, 0, 'bool', 'Create required partition tables'),
 
        function pgsqlRunScript($sScript)
        {
+               global $aCMDResult;
                // Convert database DSN to psql parameters
                $aDSNInfo = DB::parseDSN(CONST_Database_DSN);
                if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
                $sCMD = 'psql -p '.$aDSNInfo['port'].' -d '.$aDSNInfo['database'];
-               $sCMD .= ' -v ON_ERROR_STOP=1';
+               if (!$aCMDResult['ignore-errors'])
+                       $sCMD .= ' -v ON_ERROR_STOP=1';
                $aDescriptors = array(
                        0 => array('pipe', 'r'),
                        1 => STDOUT, 
                while(strlen($sScript))
                {
                        $written = fwrite($ahPipes[0], $sScript);
+                       if ($written <= 0) break;
                        $sScript = substr($sScript, $written);
                }
                fclose($ahPipes[0]);