Add osm2pgsql flat node support via settings.php

This commit is contained in:
Frederik Ramm
2013-05-16 09:03:16 +02:00
parent 7ca4259866
commit 1f2a262ee0
3 changed files with 20 additions and 0 deletions

View File

@@ -17,6 +17,9 @@
@define('CONST_Osm2pgsql_Binary', CONST_BasePath.'/osm2pgsql/osm2pgsql');
@define('CONST_Osmosis_Binary', '/usr/bin/osmosis');
// osm2pgsql settings
@define('CONST_Osm2pgsql_Flatnode_File', null);
// Replication settings
@define('CONST_Replication_Url', 'http://planet.openstreetmap.org/replication/minute');
@define('CONST_Replication_MaxInterval', '3600');

View File

@@ -154,6 +154,11 @@
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'");
}
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
{
$osm2pgsql .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
}
$osm2pgsql .= ' -lsc -O gazetteer --hstore';
$osm2pgsql .= ' -C '.$iCacheMemory;
$osm2pgsql .= ' -P '.$aDSNInfo['port'];

View File

@@ -115,6 +115,10 @@
{
// Import the file
$sCMD = CONST_Osm2pgsql_Binary.' -klas -C 2000 -O gazetteer -d '.$aDSNInfo['database'].' '.$sNextFile;
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
{
$sCMD .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
}
echo $sCMD."\n";
exec($sCMD, $sJunk, $iErrorLevel);
@@ -226,6 +230,10 @@
// import generated change file
$sCMD = CONST_Osm2pgsql_Binary.' -klas -C 2000 -O gazetteer -d '.$aDSNInfo['database'].' '.$sTemporaryFile;
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
{
$sCMD .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
}
echo $sCMD."\n";
exec($sCMD, $sJunk, $iErrorLevel);
if ($iErrorLevel)
@@ -355,6 +363,10 @@
$sCMDDownload = $sOsmosisCMD.' --read-replication-interval workingDirectory='.$sOsmosisConfigDirectory.' --simplify-change --write-xml-change '.$sImportFile;
$sCMDCheckReplicationLag = $sOsmosisCMD.' -q --read-replication-lag workingDirectory='.$sOsmosisConfigDirectory;
$sCMDImport = CONST_Osm2pgsql_Binary.' -klas -C 2000 -O gazetteer -d '.$aDSNInfo['database'].' '.$sImportFile;
if (!is_null(CONST_Osm2pgsql_Flatnode_File))
{
$sCMDImport .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
}
$sCMDIndex = $sBasePath.'/nominatim/nominatim -i -d '.$aDSNInfo['database'].' -t '.$aResult['index-instances'];
if (!$aResult['no-npi']) {
$sCMDIndex .= '-F ';