2

I want to use gdal_translate to convert a ASCII grid file onto a xyz file. But the ASCII grid is about 5.7Go and the xyz outfile is really bigger (approximately 30Go). To reduce the memory I would like to didn't store no data values but when I use -a no_data -9999 there is still lines into the xyz files like X Y -9999. It's a real problem for me, because they are useless and took too much place on my files. Also, I saw that my decimals values (Z) are quite big ! Something like 10 decimal's numbers (350.1498736541). Is that possible to ask it to troncate after 2 decimals (350.14 or better : 350.15) ?

For now, I use gdal_translate like that :

gdal_translate -of xyz -a_nodata -9999 Mosaic.asc Mosaic.xyz

closed as off-topic by BradHards, John Powell, mgri, Mapperz Jul 12 '17 at 14:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This problem cannot or can no longer be reproduced. Changes to the system or to the asker's circumstances may have rendered the question obsolete, or the question does not include a procedure to enable potential answerers to reproduce the same symptoms. Such questions are off-topic as they are unlikely to help future readers, but editing them to include more details can lead to re-opening." – BradHards, John Powell, mgri, Mapperz
If this question can be reworded to fit the rules in the help center, please edit the question.

  • If you don't have the nodata values, how will your grid or xyz file have "voids" shown? Those values indicate the voids - gdal doesn't support files without them (gdal.org/frmt_xyz.html). You could probably find a better format (TIFF, maybe?), or trim the extent so avoid them. For the decimal precision part, try the -co DECIMAL_PRECISION=2 option - I don't know if it works with XYZ, but its worth a shot. – BradHards Jul 11 '17 at 9:55
  • Well, I'm agree for a raster but for a xyz file where each line is a point, if you have a point defined as nodata, it's useless. You don't need nodata values for a cloud points. You only need them for a raster when you want to have a regular grid or at least, a grid. XYZ file didn't support DECIMAL_PRECISION :( – Lionel Jul 11 '17 at 10:35
  • Actually, I didn't write it on my post but I want a file with points only. So I think, xyz file is the best option (even if it's not optimize as a grid), we can say that I need a cloud point (to use it on an other library next: CGAL). – Lionel Jul 11 '17 at 10:39
  • GDAL won't do that, but you could write a simple script to eliminate your unwanted points - just look for the nodata value. – BradHards Jul 11 '17 at 20:54
  • yep, I finally used sed. Thank's. I let the topic without answer, maybe on a next version it will be possible. – Lionel Jul 12 '17 at 10:59