Search code examples
geolocationgeocodinggdal

How to read the geographical coordinates of a pixel in GDAL?


I have an image in UTM projection, given a pixel value (px, py) I'd need to get its corresponding utm coordinates (utx, utmy). Is it possible? I tried

gdallocationinfo  input.tif 256 256

but I did not get the expected result.

Thank you

M.


Solution

  • gdallocationinfo is for getting pixel values out of a raster. For conversion you should use gdaltransform. If you provide the target image as an argument you can enter pixel coordinates and get projected coordinates in return.

    So:

    gdaltransform input.tif
    256 256