user27477
user27477

Reputation: 21

Import OpenStreetMaps data fails

I work in project of geocoding and I want to import the OpenStreetMaps data. I created a database and named it nominatim and I tried this command:

sudo ./utils/setup.php --osm-file morocco-latest.osm.pbf --all –osm2pgsql-cache 18000 2>&1 | tee setup.log

it shows me this message :

CREATE DB 
ERROR: database already exists ( pgsql : // @/nominatim)

After I delete my database nominatim it shows this error message:

ERROR: unable to find /usr/pgsql-9.3/share/contrib/postgis-1.5/postgis.sq

BTW: I installed postgres with all the package.

Upvotes: 1

Views: 2342

Answers (3)

Stremovskyy
Stremovskyy

Reputation: 502

You also can drop nomination database by

sudo -su postgres
dropdb nominatim

Upvotes: 1

Shankar
Shankar

Reputation: 51

I have just stumbled on this error and here is how I resolved it. Edit the file

./utils/setup.php

and comment the following lines.

//array('create-db', '', 0, 1, 0, 0, 'bool', 'Create nominatim db'),

and the whole function where the database is created.

/**if ($aCMDResult['create-db'] || $aCMDResult['all']) {
echo "Create DB\n";
$bDidSomething = true;
$oDB = DB::connect(CONST_Database_DSN, false);
if (!PEAR::isError($oDB)) {
    fail('database already exists ('.CONST_Database_DSN.')');
}
passthruCheckReturn('createdb -E UTF-8 -p '.$aDSNInfo['port'].' '.$aDSNInfo['database']);

}**/

If you now run the command, it will skip the db creation and carry out the importing. Once all done remove the comments from the file.

Upvotes: 1

Deepak Patel
Deepak Patel

Reputation: 474

just change the database name in the following location

Nominatim/settings/

Edit the database name in this file settings.php.

@define('CONST_Database_DSN', 'pgsql://@/nominatim'); 

change with your database name

 @define('CONST_Database_DSN', 'pgsql://@/nominatimMorocco');

If you change your database name here than you also need to change following nominatim installation command.

./utils/specialphrases.php --countries > specialphrases_countries.sql
 psql -d nominatimMorocco -f specialphrases_countries.sql

./utils/specialphrases.php --wiki-import > specialphrases.sql
 psql -d nominatimMorocco -f specialphrases.sql

Upvotes: 0

Related Questions