0

I have a raster that is input into a model which generates outputs in a CSV format (Lon, Lat, Z value). The Lon and Lat are the centroids of the original raster's pixels. I want to use these centroids to create a new raster containing the Z value that perfectly matches the pixel size/grid of the original. Looking for a way to do this with QGIS/GDAL.

Below is a screenshot of my two files, the centroids (green) and the original raster beneath it:

centroids file on top of original raster

1 Answer 1

1

You can just use the QGIS Translate processing tool or gdal_translate as GDAL (and therefore QGIS) directly read rasters in X,Y,Z format.

Note, the file has to be sorted correctly (by Y, then X):

Cells with same Y coordinates must be placed on consecutive lines. For a same Y coordinate value, the lines in the dataset must be organized by increasing X values. The value of the Y coordinate can increase or decrease however.

See also this answer: Convert huge XYZ CSV to GeoTIFF

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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