I'd like to create a little server for us, that tells us the elevation of a point in a GeoTIFF file. I already got it working basically using the following:
dataset = gdal.Open('test_file.tif', gdal.GA_ReadOnly)
geotransform = dataset.GetGeoTransform()
px, py = convertLatLngToPixels(geotransform, lat, lng)
val = self.dataset.GetRasterBand(1).ReadAsArray(px, py, 1, 1)
Now the issues is, that our real raster file, is a VRT that combines several GeoTIFFs. Using my code now on that VRT does not work any more...
Does anybody know any solution to using a VRT file?
lifonly
option and then continue inside my code? But the issue will be thatgdallocationinfo -lifonly
is not really fast... Is there a fast way to find the file that I'd need to use inside python?