Basic question, but I have been asked to export data to an XYZ format. Is this the same as CSV files.

I am using QGIS 1.8.0. So i am presuming i select the data I want to export, right click its parent file in the window on the right and save selection as...CSV??


XYZ is an ASCII gridded data format (see the documentation) for raster data. So, it is very similar to CSV.

However, the tools available in QGIS, don't seem to support exporting to XYZ even though GDAL does (for instance it is not available under either the Save As option and neither through Raster Calculator). However, you can use the gdal_translate command-line utility to translate your raster to XYZ format. Otherwise you have to import your raster to GRASS and then do it there.

  • 3
    You can use Raster->Convert->Translate form the Qgis menu, and edit the command line from -of Gtiff to -of XYZ. "Save As" is only working for vector layers. – AndreJ Jan 4 '13 at 12:28
  • Cheers for this! – Ger Jan 4 '13 at 12:43

i havent try it for creating csv from save as csv but you can use r.out.xyz in grass.The r.out.xyz module exports a raster map as a list of x,y,z values into an ASCII text file.

r.out.xyz - Export a raster map to a text file as x,y,z values based on cell centers.

i hope it helps you...


QGIS has a GDAL plugin gdal2xyz that can do it. It is however slow and creates a huge file. Importing it back as ASCII layer in QGIS is even slower and almost freezes the whole computer.

I find r.out.xyz much faster than gdal2xyz and creates files 3 to 4 times smaller.

Loading the files back in GRASS is also much faster Below I imported the files generated by r.out.xyz (458 MB, extension xyz) (loaded in 18 s) the GDAL plugin (1.6 GB, extension csv) (loaded in 1 min 6 s).

It is true, however, that the GDAL plugin has found more points. Visually the imports look the same but the efficiency is dramatically different.

r.in.xyz input=TopoToR_Toro42.xyz.xyz output=TopoToR_XYZ separator=
Reading data ... Writing to map ... r.in.xyz complete. 11398193 points found in region. (Fri Dec 13 16:06:36 2013) Command finished (18 sec)

(Fri Dec 13 16:16:04 2013)
r.in.xyz input=TopoTor_Toro42.xyz.csv output=TopoToR_XYZ_CSV separator=, Reading data ... Writing to map ... r.in.xyz complete. 51619840 points found in region. (Fri Dec 13 16:17:11 2013) Command finished (1 min 6 sec)

Also, to import/export in XYZ format from a vector layer v.in.ascii and v.out.ascii can be used from Grass.

Your Answer

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

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