osm2pgsql: database "gis" does not exist

المشرف العام

Administrator
طاقم الإدارة
I am currently attempting to use OSM Bright to quickly style some OSM data, so I can export tiles without spending hours writing Carto in TileMill.

This is my first time using osm2pgsql to import OSM (.pbf) data into PostgreSQL. It seems that I am running from one issue into the next (missing style file, no hstore, etc. ) and I have just hit a point where I am not sure how to progress anymore.

The following message keeps popping up:

Error: Connection to database failed: FATAL: database "gis" does not exist I have nowhere entered that I want to access a database called gis .

Executing the help command and looking at the docs I realize that:

-d|--database The name of the PostgreSQL database to connect to (default: gis). Which tells me that it is most likely looking for the default database, which I do not understand, as I have indicated to use my already-created database (ethiopia):



Here is the command I have entered, and I would greatly appreciate it if anyone could tell me what I might have missed:

F:\randomGISstuff\ethiopia>osm2pgsql -c -G -U postgres -S -hstore F:\randomGISstuff\ethiopia\default.style -U postgres -d ethiopia ethiopia-latest.osm.pbf If it is easier for you to look at a cmd screenshot, here it is:



PS: the command that is featured on the OSM Bright page is definitely not sufficient in my case.


EDIT SOLUTION:


Because the solution is all hidden in comments, I will mention here what solved my issue:
1) Create a database and add the hstore to it:

CREATE EXTENSION hstore 2) make sure to set the password, not in the osm2pgsql statement, but before, like:

SET pgpassword=postgres 3) start osm2pgsql

4) Execute the following command:

osm2pgsql -c -G -U postgres --hstore -S F:\randomGISstuff\ethiopia\default.style -d ethiopia F:\randomGISstuff\ethiopia\et hiopia-latest.osm.pbf

أكثر...
 
أعلى