]> git.openstreetmap.org Git - nominatim.git/commitdiff
Merge remote-tracking branch 'upstream/master'
authorSarah Hoffmann <lonvia@denofr.de>
Thu, 4 Mar 2021 15:37:05 +0000 (16:37 +0100)
committerSarah Hoffmann <lonvia@denofr.de>
Thu, 4 Mar 2021 15:37:05 +0000 (16:37 +0100)
1  2 
CMakeLists.txt
lib-php/admin/update.php
lib-sql/functions/address_lookup.sql

diff --combined CMakeLists.txt
index 0e4234b5144bf8e1912e7ef308d1189d5e462a76,2b4c29765a29cf837049fc33b3f69fe1c2db6cab..fdc67ffe86c6c393aa77c74abed0b0c3f319f24b
@@@ -128,27 -128,6 +128,27 @@@ if (BUILD_IMPORTER
                    ${PROJECT_BINARY_DIR}/nominatim)
  endif()
  
 +#-----------------------------------------------------------------------------
 +# Targets for running a development webserver from the build directory.
 +#-----------------------------------------------------------------------------
 +
 +if (BUILD_API)
 +   set(WEBSITEFILES
 +       403.html
 +       509.html
 +       crossdomain.xml
 +       favicon.ico
 +       nominatim.xml
 +       robots.txt
 +       taginfo.json
 +   )
 +
 +   foreach (webfile ${WEBSITEFILES})
 +       configure_file(${PROJECT_SOURCE_DIR}/website/${webfile}
 +                      ${PROJECT_BINARY_DIR}/website/${webfile})
 +   endforeach()
 +endif()
 +
  #-----------------------------------------------------------------------------
  # Tests
  #-----------------------------------------------------------------------------
@@@ -198,7 -177,7 +198,7 @@@ if (BUILD_TESTS
      if (PYLINT)
          message(STATUS "Using pylint binary ${PYLINT}")
          add_test(NAME pylint
-                  COMMAND ${PYLINT} --extension-pkg-whitelist=osmium nominatim
+                  COMMAND ${PYLINT} nominatim
                   WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
      else()
          message(WARNING "pylint not found. Python linting tests disabled.")
diff --combined lib-php/admin/update.php
index e8d873cdb6bfeddd5159951b2b7774ecee99b166,81e0b832100acddc462d384a5158637224e21c09..fae4a783c6bebfdf8cd1560cf5fb2a541ee9770f
@@@ -52,7 -52,6 +52,7 @@@ loadSettings($aCMDResult['project-dir'
  setupHTTPProxy();
  
  if (!isset($aResult['index-instances'])) $aResult['index-instances'] = 1;
 +
  if (!isset($aResult['index-rank'])) $aResult['index-rank'] = 0;
  
  date_default_timezone_set('Etc/UTC');
@@@ -105,11 -104,17 +105,17 @@@ if ($fPostgresVersion >= 11.0) 
  }
  
  $oNominatimCmd = new \Nominatim\Shell(getSetting('NOMINATIM_TOOL'));
- if ($aResult['quiet']) {
-     $oNominatimCmd->addParams('--quiet');
- }
- if ($aResult['verbose']) {
-     $oNominatimCmd->addParams('--verbose');
+ function run($oCmd)
+ {
+     global $aCMDResult;
+     if ($aCMDResult['quiet'] ?? false) {
+         $oCmd->addParams('--quiet');
+     }
+     if ($aCMDResult['verbose'] ?? false) {
+         $oCmd->addParams('--verbose');
+     }
+     $oCmd->run(true);
  }
  
  
@@@ -120,7 -125,7 +126,7 @@@ if ($aResult['init-updates']) 
          $oCmd->addParams('--no-update-functions');
      }
  
-     $oCmd->run();
+     run($oCmd);
  }
  
  if ($aResult['check-for-updates']) {
@@@ -148,7 -153,7 +154,7 @@@ if (isset($aResult['import-diff']) || i
  }
  
  if ($aResult['calculate-postcodes']) {
-     (clone($oNominatimCmd))->addParams('refresh', '--postcodes')->run();
+     run((clone($oNominatimCmd))->addParams('refresh', '--postcodes'));
  }
  
  $sTemporaryFile = CONST_InstallDir.'/osmosischange.osc';
@@@ -197,35 -202,21 +203,21 @@@ if ($bHaveDiff) 
  }
  
  if ($aResult['recompute-word-counts']) {
-     (clone($oNominatimCmd))->addParams('refresh', '--word-counts')->run();
+     run((clone($oNominatimCmd))->addParams('refresh', '--word-counts'));
  }
  
  if ($aResult['index']) {
-     (clone $oNominatimCmd)
+     run((clone $oNominatimCmd)
          ->addParams('index', '--minrank', $aResult['index-rank'])
-         ->addParams('--threads', $aResult['index-instances'])
-         ->run();
+         ->addParams('--threads', $aResult['index-instances']));
  }
  
  if ($aResult['update-address-levels']) {
-     (clone($oNominatimCmd))->addParams('refresh', '--address-levels')->run();
+     run((clone($oNominatimCmd))->addParams('refresh', '--address-levels'));
  }
  
  if ($aResult['recompute-importance']) {
-     echo "Updating importance values for database.\n";
-     $oDB = new Nominatim\DB();
-     $oDB->connect();
-     $sSQL = 'ALTER TABLE placex DISABLE TRIGGER ALL;';
-     $sSQL .= 'UPDATE placex SET (wikipedia, importance) =';
-     $sSQL .= '   (SELECT wikipedia, importance';
-     $sSQL .= '    FROM compute_importance(extratags, country_code, osm_type, osm_id));';
-     $sSQL .= 'UPDATE placex s SET wikipedia = d.wikipedia, importance = d.importance';
-     $sSQL .= ' FROM placex d';
-     $sSQL .= ' WHERE s.place_id = d.linked_place_id and d.wikipedia is not null';
-     $sSQL .= '       and (s.wikipedia is null or s.importance < d.importance);';
-     $sSQL .= 'ALTER TABLE placex ENABLE TRIGGER ALL;';
-     $oDB->exec($sSQL);
+     run((clone($oNominatimCmd))->addParams('refresh', '--importance'));
  }
  
  if ($aResult['import-osmosis'] || $aResult['import-osmosis-all']) {
          $oCmd->addParams('--no-index');
      }
  
-     exit($oCmd->run());
+     run($oCmd);
  }
index b832aed83e1250621e7fe0ca110888dab36fd128,f49bc93efd52d8fbce8e008d40817398ca038f53..3206e8dbe4ba3f2f7832621a53f16168afb6946c
@@@ -121,7 -121,7 +121,7 @@@ BEGI
    END IF;
  
    --then query tiger data
-   -- %NOTIGERDATA% IF 0 THEN
+   {% if config.get_bool('USE_US_TIGER_DATA') %}
    IF place IS NULL AND in_housenumber >= 0 THEN
      SELECT parent_place_id as place_id, 'us' as country_code,
             in_housenumber as housenumber, postcode,
        WHERE place_id = in_place_id
              AND in_housenumber between startnumber and endnumber;
    END IF;
-   -- %NOTIGERDATA% END IF;
+   {% endif %}
  
-   -- %NOAUXDATA% IF 0 THEN
+   -- then additional data
+   {% if config.get_bool('USE_AUX_LOCATION_DATA') %}
    IF place IS NULL THEN
      SELECT parent_place_id as place_id, 'us' as country_code,
             housenumber, postcode,
        FROM location_property_aux
        WHERE place_id = in_place_id;
    END IF;
-   -- %NOAUXDATA% END IF;
+   {% endif %}
  
    -- postcode table
    IF place IS NULL THEN
    FOR location IN
      SELECT placex.place_id, osm_type, osm_id, name, class, type,
             coalesce(extratags->'linked_place', extratags->'place') as place_type,
 -           admin_level, fromarea, isaddress,
 +           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
        FROM place_addressline join placex on (address_place_id = placex.place_id)