This might be a dumb question, but I wasn't able to find the answer anywhere.
Reading the metadata of a raster file in Python using GDAL is as easy as:
result = str(gdal.Info(raster.tif))
print result
In this case I want to do the same for a shapefile. I know I can use ogrinfo -ro -so -al foo.shp
in the shell, but I have not found a way to do the same only in Python within a single line.
I'm looking for something like:
result = str(ogr.Info(shapefile.shp))
print result
Am I missing something obvious or is there really no function like this?
ogr.Info(shapefile.shp)
dir(ogr)
and I can't see anything in the docs. If you can hack a nice module from the cookbook recipes then it might be a nice thing to publish. You'd probably get some help... Start a project on gitlab today!