Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Read/extract pixel value of a GeoTiff

Hi there! I'm using Qt with GDAL and OpenCV to convert and display GeoTiffs. Showing works fine, the images open in the opencv popup window and I can pan and zoom around. What I want to do now is click on the image and read out the stored value of the GeoTiff, which differs from altitude/elevation to volume or others calculations I have done before. In GIS applications you have the "identify" tool which shows the layer information ((F)ID, attributes, channels and the values), that's what I want, the value of a specific coordinate by clicking on it.

I tried it with GDAL, but there should be a better way to do it directly with opencv, right?

gdallocationinfo.exe image.tif 10 10

Report: Location: (10P,10L)
Band 1:

Value: 1680.770004272461

Again, I'm not trying to read RGB values, but the ones that are stored in the GeoTiff Channel 1 (which are 32Bit Floating Point Images with values from zero to several million).

Best regards and thanks for pointers in the right direction! M