How can I convert a .tif DEM to XYZ format using QGIS?

  • 1
    Weclome to GIS SE, please provide more details to your question. – whyzar Nov 15 '16 at 17:33
  • Possible duplicate: gis.stackexchange.com/questions/201224/… – Andre Silva Nov 16 '16 at 20:56
  • 3
    This question is pretty clear. I just landed here because I wanted to ask exactly the same, and got the answer I needed. For those who need clarification, 'XYZ format' is the general name given to a raster file represented as a text file (*.txt or *.csv) with three columns for Easting, Northing and Elevation/Value/Z. It is a very effective way to interchange raster files between different software applications when their native raster formats are different. It is also easy to run scripts on them using any language for mathematical operations, filters, comparison between layers, etc. – jberrio Mar 15 '18 at 3:12

In QGIS, go to Processing toolbox / GDAL/OGR / [GDAL] Conversion / gdal2xyz

This tool will extract x, y and z to a comma separate values file (.csv).



1) results is a .csv file. If you want to convert it to .txt, just open file.csv in excel an click en save as... / Text - tab delimited .(txt)

2) to export to a .xyz file.

n QGIS, go to Processing toolbox / GDAL/OGR / [GDAL] Conversion / Translate (convert format)

Go to Save to file... and select XYZ files (*.xyz)

In your case, from GMT documentation:


To create a grid file from the ASCII data in hawaii_grv.xyz, use

gmt xyz2grd hawaii_grv.xyz -Ddegree/degree/mGal/1/0//”Hawaiian Gravity”/”GRS-80 Ellipsoid used”
   -Ghawaii_grv_new.nc -R198/208/18/25 -I5m -V


  • is this good to plot a map with GMT? – Gabriela Zeas Nuñez Nov 15 '16 at 21:54
  • I've never use GMT, only QGIS for cartography. Which kind of input do you need for GMT? – aldo_tapia Nov 16 '16 at 0:52
  • I also never use GMT, I use Arcgis and QGIS for cartography but someone request me x,y,z to plot a map with GMT. He told me that .txt and.prj it´s ok for him but I don´t know if .csv can run – Gabriela Zeas Nuñez Nov 16 '16 at 14:42
  • I edit my answer, take a look. – aldo_tapia Nov 16 '16 at 15:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.