1

Executing the below command has successfully converted a multi-band rasterFile into a multi-column CSV file.

      gdal2xyz.py -band 1 -band 2 ... -band 9 rasterFile csvFileName.csv

csvFile generated:

 0.000 0.000 1846 3260 3574 3605 3703 3749 3959 4877 6095 
 14.806 0.000 1837 3261 3570 3651 3734 3738 3945 4869 6071
 29.613 0.000 1826 3291 3582 3624 3753 3727 3931 4861 6048
 44.419 0.000 1814 3302 3589 3652 3765 3716 3916 4853 6033
 59.225 0.000 1833 3285 3566 3654 3770 3705 3914 4845 6026

How can I convert this multi-column CSV data back into a multi-band raster image? I prefer Python, GDAL, and command-line solutions.

3
  • With command line utilities, I fear in no way. The gdal2xyz.py is an alternative for the xyz driver that supports only one band gdal.org/drivers/raster/xyz.html but a script for the opposite direction does not exist. A tedious workaround is to split the CSV into several single band XYZ files by copying the first two columns and the corresponding band columns into each file.
    – user30184
    Oct 27, 2021 at 13:26
  • 2
    cp rasterFile newRasterFile
    – Ian Turton
    Oct 27, 2021 at 13:50
  • Somewhat related discussion about multiband text based coverage formats sourceforge.net/p/geoserver/mailman/geoserver-users/thread/….
    – user30184
    Oct 27, 2021 at 20:14

0

Browse other questions tagged or ask your own question.