I'm looking for a way to get the full path of a feature class within feature datasets (either in personal or file geodatabases) without using arcpy. My first attempt was to use ogr which works fine if the feature classes are stored in the geodatabase directly. But I didn't manage to get the full path if a feature dataset is involved. I tried the "OpenFileGDB" driver as well as the "FileGDB" driver. My test geodatabase stores five feature classes, four of them are within the feature dataset and one directly in the geodatabase.
My code so far:
gdb_path = r"C:\my_path\test_gdb_fd.gdb" gdb_driver = ogr.GetDriverByName("FileGDB") gdb = gdb_driver.Open(gdb_path) for featsClass_idx in range(gdb.GetLayerCount()): featsClass = gdb.GetLayerByIndex(featsClass_idx) print featsClass.GetName()
this prints the basenames of all feature classes without any information whether the feature class is within the feature dataset or not. I'm using GDAL 2.2.4, FileGDB API 1.3, Python 2.7 32 bit