0

I have millions of records and hundreds of tables in several file geodatabases..

The tables name in these FGDBs are all same but just in different areas.

For instance, the Admin table, you see below, is California data (but the FGDB named as file.gdb), and there is another Admin table in New York (also the FGDB named as file.gdb) data

enter image description here

To have better access and use st_* functions, I was importing the FGDBs to my PostgreSQL one by one. (ultimately I am going to write a bash script to automate this)

As far as I know, once the tables are imported to PostgreSQL I can append tables using -update -append options.

So, this is my command below

ogr2ogr -update -append -progress -f "PostgreSQL" PG:"host=localhost port=5433 dbname=postgres user=postgres password=postgres" file.gdb -lco GEOMETRY_NAME=shape -t_srs EPSG:3857

but this gives me this error message

Warning 1: Layer creation options ignored since an existing layer is being appended to. ERROR 1: ?ERROR 1: INSERT command for new feature failed. ?ERROR 1: Unable to write feature 1 from layer Admin. ERROR 1: Terminating translation prematurely after failed translation of layer Admin (use -skipfailures to skip errors)

Using -skipfailures seems to be dangerous because it might skip some of my data.

Will there be another solution to breakthrough this issue?

  • Please use the code formatter ({}) to make your code legible (backtics are just for individual words within a paragraph). Note that PostGIS is not a database, just the spatial extension to PostgreSQL. – Vince Oct 30 '18 at 10:36
  • @vince thanks for your comment. I am still new to the stackoverflow editing tool. I will read more carefully about the manual – Pil Kwon Oct 30 '18 at 10:46
  • The error may come from some other place. If your GDAL build supports debugging you may see something interesting by adding --debug on into your command. As a blind guess I suggest to add -unsetFid to the command. – user30184 Oct 30 '18 at 10:48
  • @user30184 I added --debug and the error says (ERROR 1: Couldn't fetch requested layer 'file.gdb'!) – Pil Kwon Oct 30 '18 at 10:52
  • Is is a violation of good security practice to load any user data as the postgres user or to the postgres database. Instead you should create login users and at least one user database (with postgis enabled). Please pick up a book on PostgreSQL before you accidentally damage your database and destroy all your effort to date. – Vince Oct 30 '18 at 10:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.