I am using ogrinfo in Python to find out information about a shapefile
from subprocess import Popen, PIPE
args = ['ogrinfo', '-so', '-al', 'C:/test/test_shapefile.shp']
process = Popen(args, stdout=PIPE, stderr=PIPE)
stdout = process.communicate()[0].decode('utf-8').strip()
print(stdout)
This obviously gives me a large summary, but I'm wondering is there any way to specify that I only want information regarding the extents or EPSG for example?
subprocessmodule? if not, there is a charmingPyShppackage for that. Also pay attention to this thread : https://gis.stackexchange.com/questions/113799/reading-shapefile-in-python – Taras Apr 26 '22 at 14:34from osgeo import gdalinstead of call asubprocess. – J. Monticolo Apr 26 '22 at 15:24