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):


1 Answer 1



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
    Commented Nov 5, 2014 at 20:39
  • 6
    There's a -lco FEATURE_DATASET=my_featurs layer creation option for FileGDB
    – Mike T
    Commented Nov 5, 2014 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! Commented Nov 6, 2014 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
    Commented Nov 24, 2016 at 0:34
  • FileGDB is not included in ogr as default. You need to download/install file gdb .dll separately using eg. osgeo
    – Losbaltica
    Commented Jan 28, 2021 at 8:49

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.