From: Sarah Hoffmann Date: Thu, 4 Mar 2021 15:37:05 +0000 (+0100) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Tag: deploy~178 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/4a2873617dcbaf58ff6135aa7d8dcb115c0cc5ba?ds=inline;hp=-c Merge remote-tracking branch 'upstream/master' --- 4a2873617dcbaf58ff6135aa7d8dcb115c0cc5ba diff --combined CMakeLists.txt index 0e4234b5,2b4c2976..fdc67ffe --- a/CMakeLists.txt +++ b/CMakeLists.txt @@@ -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 e8d873cd,81e0b832..fae4a783 --- a/lib-php/admin/update.php +++ b/lib-php/admin/update.php @@@ -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']) { @@@ -241,5 -232,5 +233,5 @@@ $oCmd->addParams('--no-index'); } - exit($oCmd->run()); + run($oCmd); } diff --combined lib-sql/functions/address_lookup.sql index b832aed8,f49bc93e..3206e8db --- a/lib-sql/functions/address_lookup.sql +++ b/lib-sql/functions/address_lookup.sql @@@ -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, @@@ -133,9 -133,10 +133,10 @@@ 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, @@@ -146,7 -147,7 +147,7 @@@ FROM location_property_aux WHERE place_id = in_place_id; END IF; - -- %NOAUXDATA% END IF; + {% endif %} -- postcode table IF place IS NULL THEN @@@ -223,7 -224,7 +224,7 @@@ 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)