0

I wanted to upload the OSM file from my local machine to server using osm2pgsql, but the data is not imported.

I have just created the database s1(no table), do I need to create the table also, if yes how?

My osm2pgsql query

osm2pgsql -c -d osm -U s1 --password xx -k -H yy  /home/g/Downloads/niedersachsen-latest.osm.pbf pbf -r -S /home/g/default.style -s

I am getting an error

Osm2pgsql failed due to ERROR: Unknown file format '-S'.
5
  • 1
    Please Edit the question to specify the error behavior ("not able to do it" is not useful)
    – Vince
    Commented May 1, 2019 at 10:50
  • I have updated the question Commented May 1, 2019 at 11:26
  • does default.style exist?
    – Fran Raga
    Commented May 1, 2019 at 11:38
  • I took a hint from a website and default. style I took it from GitHub, please suggest any other alternative, I need to import .osm.pbf Commented May 1, 2019 at 11:44
  • if that's the exact command then your syntax is wrong (e.g. it has to be -r pbf)! write that command more carefully. and check for unnecessary spaces.
    – geozelot
    Commented May 1, 2019 at 12:18

1 Answer 1

1

You can get the description of each command line parameter here or by running the command osm2pgsql -h -v

The parameter -r has the following description:

-r|--input-reader    Input format.
                        auto      - Detect file format. (default)
                        o5m       - Parse as o5m format.
                        xml       - Parse as OSM XML.
                        pbf       - OSM binary format.

In your command the value pbf is written before the -r, so it fails. You can put the parameter/value in the proper order or remove both of them, relying on the auto-detect default option.

osm2pgsql -c -d osm -U s1 --password xx -k -H yy  /home/g/Downloads/niedersachsen-latest.osm.pbf -r pbf  -S /home/g/default.style -s
2
  • Hello, thank you, that error is solved but getting another error Osm2pgsql failed due to ERROR: Open failed for 'password': No such file or directory Commented May 1, 2019 at 17:28
  • don't write the password (xx) in the command line, it will be prompted.
    – JGH
    Commented May 1, 2019 at 18:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.