I have 100s of .tiff files, and using the following command:
gdal_translate -of XYZ MCD13A2.t201624.006.global.1km_NDVI.O0.tif MCD13A2.t201624.006.global.1km_NDVI.O0.csv
This generates a .csv file but it is space separated, instead of comma separated.
Does anybody knows why this is happening, or have any solution for converting this space separated file into a comma separated .csv?
A google search revealed the following approach:
After you are done with the xyz conversion, you can just use the commandline utility sed
(suppose you use linux
):
sed 's/ /,/g' in.xyz > out.csv
Since you are creating 100s of csv files, you are probably using gdal_translate
inside a for loop, so you can just add that additional line right after gdal_translate
and you won't even notice anything!
Still, if you want to use @iFlo's method without worrying about out-of-memory problems, you can have a look at this thread.