+ if (!isset($aDSNInfo['port']) || !$aDSNInfo['port']) $aDSNInfo['port'] = 5432;
+
+ // cache memory to be used by osm2pgsql, should not be more than the available memory
+ $iCacheMemory = (isset($aResult['osm2pgsql-cache'])?$aResult['osm2pgsql-cache']:2000);
+ if ($iCacheMemory + 500 > getTotalMemoryMB())
+ {
+ $iCacheMemory = getCacheMemoryMB();
+ echo "WARNING: resetting cache memory to $iCacheMemory\n";
+ }
+ $sOsm2pgsqlCmd = CONST_Osm2pgsql_Binary.' -klas --number-processes 1 -C '.$iCacheMemory.' -O gazetteer -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'];
+ if (!is_null(CONST_Osm2pgsql_Flatnode_File))
+ {
+ $sOsm2pgsqlCmd .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
+ }
+