[gdal-dev] Getting actual path to a layer

Nyall Dawson nyall.dawson at gmail.com
Mon Jun 10 21:17:10 PDT 2019


Hi list,

If I have a bunch of say shapefiles in a folder, OGR is happy to let
me access these as a dataset, e.g.

da = r"/home/nyall/dev/QGIS/tests/testdata"
driver = ogr.GetDriverByName('ESRI Shapefile')
dataSource = driver.Open(da, 0)

for i in dataSource:
    print(i.GetName())

My question is -- GetName() here returns just the file base name (i.e.
"lines" for "/path/lines.shp"). Is there anyway to retrieve the actual
layer file path for these?

Nyall


More information about the gdal-dev mailing list