- $osm2pgsql .= ' --flat-nodes '.CONST_Osm2pgsql_Flatnode_File;
- }
-
- if (CONST_Tablespace_Osm2pgsql_Data)
- $osm2pgsql .= ' --tablespace-slim-data '.CONST_Tablespace_Osm2pgsql_Data;
- if (CONST_Tablespace_Osm2pgsql_Index)
- $osm2pgsql .= ' --tablespace-slim-index '.CONST_Tablespace_Osm2pgsql_Index;
- if (CONST_Tablespace_Place_Data)
- $osm2pgsql .= ' --tablespace-main-data '.CONST_Tablespace_Place_Data;
- if (CONST_Tablespace_Place_Index)
- $osm2pgsql .= ' --tablespace-main-index '.CONST_Tablespace_Place_Index;
- $osm2pgsql .= ' -lsc -O gazetteer --hstore --number-processes 1';
- $osm2pgsql .= ' -C '.$this->iCacheMemory;
- $osm2pgsql .= ' -P '.$this->aDSNInfo['port'];
- if (isset($this->aDSNInfo['username']) && $this->aDSNInfo['username']) {
- $osm2pgsql .= ' -U '.$this->aDSNInfo['username'];
- }
- if (isset($this->aDSNInfo['hostspec']) && $this->aDSNInfo['hostspec']) {
- $osm2pgsql .= ' -H '.$this->aDSNInfo['hostspec'];
- }
- $aProcEnv = null;
- if (isset($this->aDSNInfo['password']) && $this->aDSNInfo['password']) {
- $aProcEnv = array_merge(array('PGPASSWORD' => $this->aDSNInfo['password']), $_ENV);
- }
- $osm2pgsql .= ' -d '.$this->aDSNInfo['database'].' '.$sOSMFile;
- runWithEnv($osm2pgsql, $aProcEnv);
- if ($this->oDB == null) $this->oDB =& getDB();
- if (!$this->sIgnoreErrors && !chksql($this->oDB->getRow('select * from place limit 1'))) {
+ $oCmd->addParams('--flat-nodes', CONST_Osm2pgsql_Flatnode_File);
+ }
+ if (CONST_Tablespace_Osm2pgsql_Data) {
+ $oCmd->addParams('--tablespace-slim-data', CONST_Tablespace_Osm2pgsql_Data);
+ }
+ if (CONST_Tablespace_Osm2pgsql_Index) {
+ $oCmd->addParams('--tablespace-slim-index', CONST_Tablespace_Osm2pgsql_Index);
+ }
+ if (CONST_Tablespace_Place_Data) {
+ $oCmd->addParams('--tablespace-main-data', CONST_Tablespace_Place_Data);
+ }
+ if (CONST_Tablespace_Place_Index) {
+ $oCmd->addParams('--tablespace-main-index', CONST_Tablespace_Place_Index);
+ }
+ $oCmd->addParams('--latlong', '--slim', '--create');
+ $oCmd->addParams('--output', 'gazetteer');
+ $oCmd->addParams('--hstore');
+ $oCmd->addParams('--number-processes', 1);
+ $oCmd->addParams('--cache', $this->iCacheMemory);
+ $oCmd->addParams('--port', $this->aDSNInfo['port']);
+
+ if (isset($this->aDSNInfo['username'])) {
+ $oCmd->addParams('--username', $this->aDSNInfo['username']);
+ }
+ if (isset($this->aDSNInfo['password'])) {
+ $oCmd->addEnvPair('PGPASSWORD', $this->aDSNInfo['password']);
+ }
+ if (isset($this->aDSNInfo['hostspec'])) {
+ $oCmd->addParams('--host', $this->aDSNInfo['hostspec']);
+ }
+ $oCmd->addParams('--database', $this->aDSNInfo['database']);
+ $oCmd->addParams($sOSMFile);
+ $oCmd->run();
+
+ if (!$this->sIgnoreErrors && !$this->oDB->getRow('select * from place limit 1')) {