[GIS] Extract row & column numbers of a raster at points in QGIS

qgisrastersampling

Is there a tool in QGIS that will extract the row and column numbers of a raster at a set of points? All I have been able to find is the following:

  • Raster Analysis > Sample raster values
  • (Plugin) Point Sampling Tool
  • GRASS > Vector > v.sample

None of these return the row & column number of the point, as far as I have been able to tell.

I also found this question, but it is rather in-depth and I was hoping to find a tool which could do it automatically if possible.

Best Answer

One way to do this is with the gdallocationinfo utility:

micha@TP480:GTOPO30$ gdallocationinfo -geoloc gt30e020n40.tif 31 29
Report:
  Location: (1320P,1320L)
  Band 1:
    Value: 15

You enter the X-Y the -geoloc parameter, and X-Y coords at the end, and it returns the Pixel and Line numbers (together with the value at that pixel)