-$sOsm2pgsqlCmd = CONST_Osm2pgsql_Binary.' -klas --number-processes 1 -C '.$iCacheMemory.' -O gazetteer -S '.CONST_Import_Style.' -d '.$aDSNInfo['database'].' -P '.$aDSNInfo['port'];
-if (isset($aDSNInfo['username']) && $aDSNInfo['username']) {
- $sOsm2pgsqlCmd .= ' -U ' . $aDSNInfo['username'];
-}
+
+$oOsm2pgsqlCmd = (new \Nominatim\Shell(CONST_Osm2pgsql_Binary))
+ ->addParams('--hstore')
+ ->addParams('--latlong')
+ ->addParams('--append')
+ ->addParams('--slim')
+ ->addParams('--number-processes', 1)
+ ->addParams('--cache', $iCacheMemory)
+ ->addParams('--output', 'gazetteer')
+ ->addParams('--style', CONST_Import_Style)
+ ->addParams('--database', $aDSNInfo['database'])
+ ->addParams('--port', $aDSNInfo['port']);
+