1

So basically I imported .gdb package into PostgreSQL with the following command:

ogr2ogr  -f "PostgreSQL"   PG:"dbname='my_database'" "ntest.gdb" "layername" -nln table_layername

I have about 50+ layers in one GDB, so I run this script for all 50+ layers. After all the tables have been edited/processed, I have to dump all my 50+ tables into one .gdb again. I have tried as suggested here

ogr2ogr -f "FileGDB" errors.gdb  PG:"dbname='my_database' tables='table_layername, table_layername2, etc'"

But this gives me errors:

ERROR 1: PQconnectdb failed. missing "=" after "table_layername2," in connection info string

If I run the same command without tables part in PG, but specifying the table in the end it gives me:

ERROR 1: Unable to find driver `FileGDB'.

If I try the existing driver "OpenFileGDB", the error is:

ERROR 1: OpenFileGDB driver does not support data source creation.

I guess it is because OpenFileGDB is only read-only, whereas FileGDB is read and write access (source).

All the information I am finding is old (2012-2015)6 so my question is:

  1. Where to find and how to install the `FileGDB' driver? Does it still exist?
  2. If I could install it, how can dump all my tables into one .gdb file? Will my command work if the driver is installed?

Edit: My Operating System: Debian GNU/Linux 9 (stretch); Kernel: Linux 4.9.0-8-amd64; Architecture: x86-64;

2
  • What is your OS? Need to know if need to recommand how to install – ThomasG77 Feb 2 at 12:45
  • @ThomasG77 Operating System: Debian GNU/Linux 9 (stretch) Kernel: Linux 4.9.0-8-amd64 Architecture: x86-64 – amelie Feb 2 at 14:47
1

Where to find and how to install the `FileGDB' driver? Does it still exist?

You need to compile yourself gdal using a recipe like below (tested on Ubuntu 18.04, should not differ a lot for your OS target)

# Update install
sudo apt update && sudo apt upgrade
# Get deps to reuse deps instead of installing them by hand
sudo apt-get build-dep gdal-bin

# Retrieve FileGDB SDK
wget https://github.com/Esri/file-geodatabase-api/raw/master/FileGDB_API_1.5/FileGDB_API_1_5_64gcc51.tar.gz
tar xzf FileGDB_API_1_5_64gcc51.tar.gz
sudo cp -r FileGDB_API-64gcc51/* /usr/
sudo ldconfig

cd ~
git clone https://github.com/OSGeo/gdal
cd gdal/gdal
git checkout v2.4.4 # GDAL 3 require Proj 6 and not bundled by default on my distro, so want to avoid compilation of this dep
# If your distro use GDAL 3.x, replace above line with below
# git checkout v3.2.1

# Directory for compiling to local install (to not pollute your gdal install on the system)
mkdir ~/gdallocal
root_gdal=$HOME/gdallocal
CCACHE_CPP2=yes CC='ccache gcc' CXX='ccache g++' LDFLAGS='-lstdc++' CFLAGS="-fPIC" ./configure --prefix=$root_gdal --without-libtool --with-jpeg12 --with-python --with-poppler --with-spatialite --with-liblzma --with-webp --with-epsilon --with-proj=yes --with-poppler --with-hdf5 --with-fgdb=/usr
make
make install

export PATH=$root_gdal/bin:$PATH
export LD_LIBRARY_PATH=$root_gdal/lib:$LD_LIBRARY_PATH
export GDAL_DATA=$root_gdal/share/gdal

# Check that FileGDB has been compiled
ogrinfo --formats |grep GDB
# Should output below
#  OpenFileGDB -vector- (rov): ESRI FileGDB
#  FileGDB -vector- (rw+): ESRI FileGDB

If I could install it, how can dump all my tables into one .gdb file? Will my command work if the driver is installed?

With above GDAL version compiled and below code, "it works" on my machine (OS Ubuntu 18.04 x64). Avoid space between comma in tables=...

ogr2ogr -f "FileGDB" output.gdb PG:"dbname='dbname' user='youruser' schemas=public tables=table1,table2"

Your Answer

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

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