16

I ran into a problem when loading a ESRI Geodatabase format .gdb into PostGIS. I have data 2.5GB GDB file. I followed some tutorials on the internet, but it seems that doesn't work out.

  1. I created a database "SampleNY"
  2. I executed this from the console:

    ogr2ogr -f "PostgreSQL" PG:"dbname=SampleNY user=postgres" NYPluto/Pluto.gdb

But nothing happens, I didn't got neither an error nor a successful operation. Did I miss any steps?

  • Are you limited to using ogr2ogr? Or are you open to other solutions? FME should be able to do this easily. – Fezter Jan 15 '14 at 4:07
  • I am open to any solution that can solve this problem ? Can you provide more details about how to do that ? – user3001937 Jan 15 '14 at 4:08
  • Try downloading FME. Create a new workbench and add a Geodatabase Reader and a PostGIS writer. – Fezter Jan 15 '14 at 4:09
  • 1
    It is a commercial solution. You didn't specify you were only looking for free solutions. I think FME has a free trial period. – Fezter Jan 15 '14 at 4:22
  • 1
    I found in other answers Spatial Data Manager. mapet.altervista.org This is a free windows tool to load shapefile and file geodatabase in Postgis and other spatial db. – lele3p Jan 15 '14 at 5:13
17

Try adding appropriate host and port arguments.
And BTW, when I import a large GDB file, I also add these flags:

-overwrite (erases any mess you may have already inserted) and

-progress (displays a dot or number for every 10,000 or 10% records added):

--config PG_USE_COPY YES (greatly improves speed)

So the command (which should be a one-liner but i formatted here for clarity) becomes

ogr2ogr 
    -f "PostgreSQL" 
    PG:"host=localhost port=5432 dbname=SampleNY user=postgres" 
    NYPluto/Pluto.gdb 
    -overwrite -progress --config PG_USE_COPY YES

Use a URL in place of "localhost" if needed.

5

If there are multiple features in the gdb and you want to specify the Postgres schema and table names then follow:

#First get the featurenames from the gdb:
ogrinfo geodbname.gdb

#then import a feature into a table:
ogr2ogr -f "PostgreSQL" PG:"host=hostname port=5432 dbname=dbname user=postgres"
geodbname.gdb -nlt PROMOTE_TO_MULTI -nln schemaname.tablename featurename -overwrite

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.