+ // 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 -C '.$iCacheMemory.' -O gazetteer -d '.$aDSNInfo['database'];
+ if (!is_null(CONST_Osm2pgsql_Flatnode_File))
+ {
+ $sOsm2pgsqlCmd .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
+ }
+
+