I am new to GDAL in Python and would like to use it to create a list of populated layers in a ArcGIS mdb Feature datasets. I have the code below that provides a list of all the populated layers but it returns a list for all the datasets in the database. The database has Feature datasets for municipal water systems, sewer systems, transportation systems, etc. How can I return only the layer counts for one of these Feature datasets and all of its layers; i.e Feaure dataset = water_systems and returns layers of Water_lines, Fire_Hydrants, Water_Valves, etc.?
Thanks in advance.
import osgeo.ogr as ogr driver = ogr.GetDriverByName('PGeo') ds = driver.Open(database) numLayers = ds.GetLayerCount() for layerNum in range(numLayers): layer = ds.GetLayer(layerNum) if layer.GetFeatureCount() > 0: print '%s features: %s' % (layer.GetName(), layer.GetFeatureCount())
[Edit: Additional Info]
When running OGRINFO -al on the data base I get a lot of information but was able to pull out the following:
OGRFeature(GDB_Items):70 ObjectID (Integer) = 70 UUID (String) = DB50B2B0-9DC6-4492-9CAD-4162580231B6 Type (String) = 70737809-852C-4A03-9E22-2CECEA5B9BFA Name (String) = WaterV PhysicalName (String) = WATERV Path (String) = \Water_Sys\WaterV DatasetSubtype1 (Integer) = 1 DatasetInfo1 (String) = SHAPE ...
Further down the massive list was:
OGRFeature(GDB_Items):827 ObjectID (Integer) = 827 UUID (String) = 22CAD8B9-DBBE-44A6-9D8C-86896CC23B72 Type (String) = 70737809-852C-4A03-9E22-2CECEA5B9BFA Name (String) = Signal_3 PhysicalName (String) = SIGNAL_3 Path (String) = \Trans\Signal_3 DatasetSubtype1 (Integer) = 1 DatasetInfo1 (String) = Shape ...
Note the Path parameter contains the ArcGIS Feature Dataset Name!!!
How can I read this using GDAL in Python?