I want to get the pixel size (resolution) of a raster without opening up the raster in gdal. I currently have my script opening the raster in GDAL using gdal.Open()
and getting the resolution that way. However this process is slow especially when my TIFFs are large and I have many of them.
from osgeo import gdal
data_path = "some/path/to/raster.tif"
ds = gdal.Open(data_path)
# md = ds.GetMetadata() # read metadata
gt = raster.GetGeoTransform()
pixelSizeX = gt[1]
pixelSizeY =-gt[5]
Is there a way to grab this info from the metadata or something without opening the file?
gdal.Open()
shouldn't be too expensive without actually reading any data