echo "Please download and build osm2pgsql.\nIf it is already installed, check the path in your local settings (settings/local.php) file.\n";
fail("osm2pgsql not found in '$osm2pgsql'");
}
+ $osm2pgsql .= ' --tablespace-slim-index ssd --tablespace-main-index ssd --tablespace-main-data ssd --tablespace-slim-data data';
$osm2pgsql .= ' -lsc -O gazetteer --hstore';
- $osm2pgsql .= ' -C '.$iCacheMemory;
+ $osm2pgsql .= ' -C 16000';
$osm2pgsql .= ' -d '.$aDSNInfo['database'].' '.$aCMDResult['osm-file'];
- passthru($osm2pgsql);
+ passthruCheckReturn($osm2pgsql);
$oDB =& getDB();
$x = $oDB->getRow('select * from place limit 1');
echo '.';
}
echo "\n";
+ pgsqlRunScript('ALTER TABLE place SET TABLESPACE "data"');
echo "Reanalysing database...\n";
pgsqlRunScript('ANALYSE');
}
{
$bDidSomething = true;
+ pgsqlRunScriptFile(CONST_BasePath.'/sql/tiger_import_start.sql');
+
$aDBInstances = array();
for($i = 0; $i < $iInstances; $i++)
{
}
echo "\n";
}
+
+ echo "Creating indexes\n";
+ pgsqlRunScriptFile(CONST_BasePath.'/sql/tiger_import_finish.sql');
}
if ($aCMDResult['calculate-postcodes'] || $aCMDResult['all'])
$sOutputFile = '';
if (isset($aCMDResult['index-output'])) $sOutputFile = ' -F '.$aCMDResult['index-output'];
$sBaseCmd = CONST_BasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$iInstances.$sOutputFile;
- passthru($sBaseCmd.' -R 4');
+ passthruCheckReturn($sBaseCmd.' -R 4');
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
- passthru($sBaseCmd.' -r 5 -R 25');
+ passthruCheckReturn($sBaseCmd.' -r 5 -R 25');
if (!$aCMDResult['index-noanalyse']) pgsqlRunScript('ANALYSE');
- passthru($sBaseCmd.' -r 26');
+ passthruCheckReturn($sBaseCmd.' -r 26');
}
if ($aCMDResult['create-search-indices'] || $aCMDResult['all'])
proc_close($hProcess);
}
+
+ function passthruCheckReturn($cmd)
+ {
+ $result = -1;
+ passthru($cmd, $result);
+ if ($result != 0) fail('Error executing external command: '.$cmd);
+ }