osm2pgsql error: Cannot detect file format for 'postgres'. Try using -r

63 views Asked by At

I am trying to import pbf file into postgis database using osm2pgsql.

I can connect to database, but when i try to import the file:

C:\osm2pgsql>osm2pgsql -s -a -d micronesia --flat-nodes C:\osm2pgsql\srbac.osm.pbf -U postgres -W postgres C:\osm2pgsql\micronesia.osm.pbf

at first the program is asking for my password (postgres), and when I retype it, then it sends me an error message:

ERROR: Cannot detect file format for 'postgres'. Try using -r.

Can anyone help me? Why should I define the file format for password?!

I already described the problem

1

There are 1 answers

1
JGH On

-W is the command for a password prompt, so you would have to type it when prompted.

The next argument is the expected pbf file, but here you wrote your password instead so it fails.