X-Git-Url: https://git.openstreetmap.org/nominatim.git/blobdiff_plain/c391479c5852f165c4be85b6e39d1290ae2d4a58..b328bcf5186ddfe9f1c2f8acf9eee6859d1410da:/utils/setup.php diff --git a/utils/setup.php b/utils/setup.php index f7ebafa6..3fad6fe8 100755 --- a/utils/setup.php +++ b/utils/setup.php @@ -33,7 +33,6 @@ array('disable-token-precalc', '', 0, 1, 0, 0, 'bool', 'Disable name precalculation (EXPERT)'), array('import-tiger-data', '', 0, 1, 0, 0, 'bool', 'Import tiger data (not included in \'all\')'), array('calculate-postcodes', '', 0, 1, 0, 0, 'bool', 'Calculate postcode centroids'), - array('create-roads', '', 0, 1, 0, 0, 'bool', ''), array('osmosis-init', '', 0, 1, 0, 0, 'bool', 'Generate default osmosis configuration'), array('index', '', 0, 1, 0, 0, 'bool', 'Index the data'), array('index-noanalyse', '', 0, 1, 0, 0, 'bool', 'Do not perform analyse operations during index (EXPERT)'), @@ -467,40 +466,17 @@ pgsqlRunScript('ANALYSE'); } - if ($aCMDResult['create-roads']) - { - $bDidSomething = true; - - $oDB =& getDB(); - $aDBInstances = array(); - for($i = 0; $i < $iInstances; $i++) - { - $aDBInstances[$i] =& getDB(true); - if (!pg_query($aDBInstances[$i]->connection, 'set enable_bitmapscan = off')) fail(pg_last_error($oDB->connection)); - $sSQL = 'select count(*) from (select insertLocationRoad(partition, place_id, calculated_country_code, geometry) from '; - $sSQL .= 'placex where osm_id % '.$iInstances.' = '.$i.' and rank_search between 26 and 27 and class = \'highway\') as x '; - if ($aCMDResult['verbose']) echo "$sSQL\n"; - if (!pg_send_query($aDBInstances[$i]->connection, $sSQL)) fail(pg_last_error($oDB->connection)); - } - $bAnyBusy = true; - while($bAnyBusy) - { - $bAnyBusy = false; - for($i = 0; $i < $iInstances; $i++) - { - if (pg_connection_busy($aDBInstances[$i]->connection)) $bAnyBusy = true; - } - sleep(1); - echo '.'; - } - echo "\n"; - } - if ($aCMDResult['import-tiger-data']) { $bDidSomething = true; - pgsqlRunScriptFile(CONST_BasePath.'/sql/tiger_import_start.sql'); + $sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_start.sql'); + $sTemplate = str_replace('{www-user}', CONST_Database_Web_User, $sTemplate); + $sTemplate = replace_tablespace('{ts:aux-data}', + CONST_Tablespace_Aux_Data, $sTemplate); + $sTemplate = replace_tablespace('{ts:aux-index}', + CONST_Tablespace_Aux_Index, $sTemplate); + pgsqlRunScript($sTemplate, false); $aDBInstances = array(); for($i = 0; $i < $iInstances; $i++) @@ -508,7 +484,7 @@ $aDBInstances[$i] =& getDB(true); } - foreach(glob(CONST_BasePath.'/data/tiger2011/*.sql') as $sFile) + foreach(glob(CONST_Tiger_Data_Path.'/*.sql') as $sFile) { echo $sFile.': '; $hFile = fopen($sFile, "r"); @@ -552,7 +528,13 @@ } echo "Creating indexes\n"; - pgsqlRunScriptFile(CONST_BasePath.'/sql/tiger_import_finish.sql'); + $sTemplate = file_get_contents(CONST_BasePath.'/sql/tiger_import_finish.sql'); + $sTemplate = str_replace('{www-user}', CONST_Database_Web_User, $sTemplate); + $sTemplate = replace_tablespace('{ts:aux-data}', + CONST_Tablespace_Aux_Data, $sTemplate); + $sTemplate = replace_tablespace('{ts:aux-index}', + CONST_Tablespace_Aux_Index, $sTemplate); + pgsqlRunScript($sTemplate, false); } if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all']) @@ -601,7 +583,7 @@ } // Find the last node in the DB - $iLastOSMID = $oDB->getOne("select max(id) from planet_osm_nodes"); + $iLastOSMID = $oDB->getOne("select max(osm_id) from place where osm_type = 'N'"); // Lookup the timestamp that node was created (less 3 hours for margin for changsets to be closed) $sLastNodeURL = 'http://www.openstreetmap.org/api/0.6/node/'.$iLastOSMID."/1"; @@ -728,6 +710,7 @@ @symlink(CONST_BasePath.'/website/reverse.php', $sTargetDir.'/reverse.php'); @symlink(CONST_BasePath.'/website/search.php', $sTargetDir.'/search.php'); @symlink(CONST_BasePath.'/website/search.php', $sTargetDir.'/index.php'); + @symlink(CONST_BasePath.'/website/lookup.php', $sTargetDir.'/lookup.php'); @symlink(CONST_BasePath.'/website/deletable.php', $sTargetDir.'/deletable.php'); @symlink(CONST_BasePath.'/website/polygons.php', $sTargetDir.'/polygons.php'); @symlink(CONST_BasePath.'/website/status.php', $sTargetDir.'/status.php');