I am dumping postgis tables into a file geodatabase and it works great--the result is a file geodatabase full of featureclasses.

But is it possible to write these featureclasses into feature datasets (they are the same spatial reference):




If your feature classes are saved as *.shp, you could try:

ogr2ogr -f "FileGDB" mygdb.gdb ~/PathTo/MyFeatureClass.shp -lco FEATURE_DATASET=my_features

However, since you are exporting from PostGIS another approach could be something like this:

ogr2ogr -f "FileGDB" mygdb.gdb PG:"host=my_host user=my_user_name dbname=my_db_name password=my_password" -sql "SELECT gid, name, the_geom from fd_line_Test" -lco FEATURE_DATASET=my_features

Alternatively, you can just point the PostGIS tables:

ogr2ogr -f "FileGDB" mygdb.gdb PG:"host=my_host user=my_user_name dbname=my_db_name password=my_password" fd_lines_test fd_poly_test fd_pt_test -lco FEATURE_DATASET=my_features

Simlliar to the last one will be if you export and import from GeoDatabase:

ogr2ogr -f "FileGDB" mygdb.gdb IdentityTest.gdb fd_lines_test fd_poly_test fd_pt_test -lco FEATURE_DATASET=my_features

ESRI File Geodatabase (FileGDB) Layer Creation Options

  • 2
    The question is asking about feature dataset.
    – artwork21
    Nov 5 '14 at 20:39
  • 6
    There's a -lco FEATURE_DATASET=my_featurs layer creation option for FileGDB
    – Mike T
    Nov 5 '14 at 20:43
  • -lco FEATURE_DATASET....that's what I was looking for. That's so much easier than the way I was hacking it! Nov 6 '14 at 13:52
  • Hi @Hristo Tomov, I'm trying to use the code you provided __ ogr2ogr -f "FileGDB" mygdb.gdb ~/PathTo/MyFeatureClass.shp -lco FEATURE_DATASET=my_features __ to convert a shapefile to a gbd feature class but I get errors like: unable to find driver 'filegdb'. any help is appreciated.
    – Mehdi
    Nov 24 '16 at 0:34
  • FileGDB is not included in ogr as default. You need to download/install file gdb .dll separately using eg. osgeo
    – Losbaltica
    Jan 28 '21 at 8:49

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.