3

I am trying to convert ESRI FileGDB to PostGIS

  • I created a new database: 'newkelibia' with pgAdmin 4

  • using OSGeo4W shell I executed this:

     ogr2ogr, -f "PostgreSQL" PG:"host=localhost port=5432 user='postgres' password='1234' dbname='newkelibia'" C:\Users\ons\Documents\CityEngine\Default Workspace\new_project\models\KlibiaBD.gdb" -overwrite -progress --config PG_USE_COPY YES
    

and I got this error:

ERROR 1: PostgreSQL driver doesn't currently support database creation. Please create database with the `createdb' command. ERROR 1: PostgreSQL driver failed to create

Did I mess any steps ?

8
  • 1
    did you add the postgis extension to the database?
    – Ian Turton
    Commented Jan 14, 2021 at 14:14
  • Have you tried without the single quotes in dbname='newkelibia'
    – Bera
    Commented Jan 14, 2021 at 14:23
  • Do I count wrong or is there one closing " missing? And test the connection first with ogrinfo PG:"host=localhost port=5432 user='postgres' password='1234' dbname='newkelibia'".
    – user30184
    Commented Jan 14, 2021 at 14:26
  • @lan Turton yes Commented Jan 14, 2021 at 14:51
  • @user30184 I add the missing , and I tested the connection now : ogrinfo PG:"host=localhost port=5432 user='postgres' password='1234' dbname='newkelibia'" INFO: Open of PG:host=localhost port=5432 user='postgres' password='1234' dbname='newkelibia'' using driver PostgreSQL' successful. AND I GOT THE SAME MSG Commented Jan 14, 2021 at 14:55

1 Answer 1

1

Running ogr2ogr so that the program name is followed by a comma "," gives rather similar error message for me on Windows.

ogr2ogr, -f "PostgreSQL" PG:"host=localhost port=5432 user='user' password='password' dbname='test'" -overwrite test.gpkg --config PG_USE_COPY YES
ERROR 1: PostgreSQL driver doesn't currently support database creation.
Please create database with the `createdb' command.
ERROR 1: PostgreSQL driver failed to create ,

Syntax ogr2ogr -f "PostgreSQL" ... works fine.

I am not sure if this is some sort of bug. It seems that comma can follow the native Windows commands and then it means a separator between the command and the first parameter. So this dir,/s,c:\temp does the same job than dir /s c:\temp.

See also https://stackoverflow.com/questions/47222968/what-does-the-comma-after-a-command-do. Anyway, commas do not work as parameter separators for gdal command line utilities. Use spaces.

3
  • thank you @user30184 I have no more error message or any message, what does this mean ? Commented Jan 17, 2021 at 16:56
  • Hopefully success. Have a look at your database.
    – user30184
    Commented Jan 17, 2021 at 16:57
  • unfortunately , nothing has changed :( Commented Jan 19, 2021 at 21:31

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.