I have a GeoTIFF file which contains 13 bands and I want to create one .csv file using gdal_translate, but by default GDAL generates one CSV with one band's data
I want this kind of CSV:
lat longi band1 band2 band3 band4
2.565 45.545 45 65 34 34
I want to know if it is possible using GDAL.
gdal_translate -of XYZ -b 4 -b 8 subset_S2A_OPER_MTD_SAFL1C_PDMC_20161017T172323_R019_V20161016T050802_20161016T051302_resampled_b4_b8_reprojected.tif subset_S2A_OPER_MTD_SAFL1C_PDMC_20161017T172323_R019_V20161016T050802_20161016T051302_resampled_b4_b8_reprojected.csv
Here only one band is selected ……
Best Answer
AFAIK
gdal_translate
is able to convert only one band into XYZ format, so I suggest the following workflow:gdal_translate
to convert each band into a CSV file;ogr2ogr
to append each CSV file to an SQLite file;ogrinfo
to create the index on theogc_fid
field of each SQLite table in order to make the last step fast;This is a sample batch file where the above steps are implemented for only three bands (change the
FILENAME
variable and adapt the join query according to your input data):