Skip to main content
2 of 2
Added proper code block (removed triple >>> from code printout)

You're almost there. This is on Windows 7, Python 2.6.5 32bit, and GDAL 1.9.0:

 from osgeo import ogr driver = ogr.GetDriverByName("FileGDB") ds = driver.Open(r"C:\temp\buildings.gdb", 0) ds <osgeo.ogr.DataSource; proxy of <Swig Object of type 'OGRDataSourceShadow *' at 0x02BB7038> > ds.GetLayer("buildings") <osgeo.ogr.Layer; proxy of <Swig Object of type 'OGRLayerShadow *' at 0x02BB7050> > b = ds.GetLayer("buildings") sr = b.GetSpatialRef() sr <osgeo.osr.SpatialReference; proxy of <Swig Object of type 'OSRSpatialReferenceShadow *' at 0x02BB7080> > sr.ExportToProj4() '+proj=utm +zone=15 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ' 

Once you open the FGDB, then use GetLayer to get at your featureclass.

Chad Cooper
  • 12.8k
  • 4
  • 48
  • 88