I am using QGIS and I have a raster from which I would like to extract all the pixel values and if possible their corresponding coordinates.

I am able to use the identify feature option to point to a location on the raster to get the individual raster value; but, I would like to do this for all points without having to click all of them.

  • 2
    If it's a single band raster translate to XYZ format, this will give you a file of all the X,Y and cell values in text, but such a file can be unwieldy. What sort of raster is it? – Michael Stimson Jun 26 '17 at 22:32
  • It is an elevation raster that I obtained by performing DSM (raster)-DEM (raster) . I will try what you said, I am quite new to this. Thanks for your input. – Adi Jun 26 '17 at 22:39
  • 1
    What is the ultimate objective? It seems like may need to do some sampling across your raster. What is the purpose of obtaining all the pixel values? Would you prefer this summarized in a histogram? – Aaron Jun 27 '17 at 1:31
  • @MichaelStimson thanks for your advise, I was able to get the values from Qgis using the Translate option. Though the text file created was really big, I was able to split it using a software. – Adi Jun 28 '17 at 21:58
  • 1
    Text XYZ is probably the worst raster format for size, even more bloated than Esri ASCII, but some packages (for example AutoCAD) will only use gridded XYZ. If you have a sub-area in mind you can use -srcwin (offset, rows and columns) or -projwin (extent of the sub-area in georeference coordinates) with GDAL_Translate to create smaller files. – Michael Stimson Jun 28 '17 at 22:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.