I have upgraded to GDAL 2.1 on Windows, binaries from: http://www.gisinternals.com/query.html?content=filelist&file=release-1800-gdal-2-1-2-mapserver-7-0-2.zip

I am able to use the command line:

> ogrinfo -al "C:/path/to/my/folder.gdb"

and it works fine, giving me details of the contents.

However, from my C code:

 GDALDatasetH dataset = GDALOpen( "C:/path/to/my/folder.gdb", GA_ReadOnly );

I get back NULL, and the console says:

  ERROR 4: `C:/path/to/my/folder.gdb' not recognized as a supported file format.

Yet I am still able to successfully open other files with GDALOpen(), such as .tiff, .sid, and others (all rasters, this is the first time I'm trying to open a vector file). Further, when I use GDALGetDriverCount() and GDALGetDriver(), and print the short and long name of each driver, I get a list of 200 drivers, including:

159 ESRI Personal GeoDatabase -- PGeo
160 MySQL -- MySQL
161 ESRI FileGDB -- OpenFileGDB

At one point I was including ogr_FileGDB.dll in my plugins directory, and that was giving a .dll load error on GDALAllRegister() because I don't have the Esri GDB SDK .dlls. But I thought maybe just having ogr_FileGDB.dll in the plugins directory was confusing GDAL and that's why the OpenFileGDB driver wasn't working. But even after removing ogr_FileGDB.dll from the plugins directory, I still get NULL when opening the .gdb.

Any ideas for how I can figure out what's going on?

  • 1
    The "OpenFileGDB" driver doesn't have anything to do with Esri's file geodatabase DLL. – Vince Nov 21 '16 at 1:02
  • Well, if I had the Ersi SDK installed and both the FileGDB driver and the OpenFileGDB driver got registered, and then I opened a .gdb folder, presumably one of those drivers would chosen to open the dataset, in preference to the other, so in that way they do have something to do with each other, right? – M Katz Nov 22 '16 at 1:23
  • No, GDAL would have something to do with each of them. Directionality is important. A->B and A->C does not imply B->C or C->B – Vince Nov 22 '16 at 1:44


GDAL can only read vector data from File GDBs and the GDALOpen method is for raster data. This is why you get ERROR 4: 'C:/path/to/my/folder.gdb' not recognized as a supported file format..

In GDAL 1.X you would use OGROpen to open vector data.

In GDAL 2.X you can still use OGROpen to open vector data and GDALOpen to open raster data but note that both methods are deprecated in favour of the unified method GDALOpenEx.


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.