QGIS - XYZ to FLT By mike on 28th March 2021 03:56:23 PM
  2. …Or how to burn flt’s from xyz’s from the command prompt or in QGIS python…
  3. ________________________________________
  4. FLT’s are the to-go standard type file when sharing bathymetry files. They load fast, store depth information and are lighter than the equivalent .xyz file. These file are binary and are also called ENVI ‘hdr files, or single band binary .bil files. How do you make them?
  5. Option 1, the pythonic way, making use of GDAL with QGIS 3.4
  6. 1.      Open QGIS 3.4 . I recommend using a new and clean instance as it will probably freeze QGIS for a while.
  7. 2.      Open the python console, and click on the (open script) icon.
  8. 3.      Open the script xyz2flt.py
  9. 4.      Change line 13,15,17,19 according to your needs (they refer to infolder, outfolder, pixelsize,epsgcode).
  11. Run the program, be patient as depending on the file sizes it might look like QGIS crashed. In case it takes too long to output any kind of message, check the task manager by ctrl+alt+supr and viewing the processes tab. qgis-bin.exe is the process taking more memory and looks unresponsive, on the other hand gdal_translate.exe  increments its memory usage.
  12. Option 2, the front door, make use of GDAL with shell commands
  13. 1.      Open the little xyz2flt.bat file with a text editor –for example notepad-.
  14. a.      Change the variable mypath to the folder where you have your XYZ files stored
  15. i.e.  SET mypath=E:\input\
  17. b.      Change line 4 in case your files have a different extension than regular xyz.  the section you need to change is the part preceding the asterisk(*).
  18. In the example below we want to transform .txt files
  19. i.e.    FOR /F %%i IN ('DIR /B %mypath%*.txt) DO (
  20. Save the file, and close
  22. 5.      Now, press the windows key and type “osgeo4wshell”. Enter the shell and navigate to the folder where you have stored the xyz2flt.bat. In case you don’t know how to navigate through folders from the command line go to this link. Once you are in the folder, type xyz2flt.bat and press enter. In case you have a ungridded error,or many stepY values, your ASCII file has not been written correctly (ordered by Y descending, X ascending). In this case use option 1.

Hasta la pasta! is for source code and general debugging text.

Login or Register to edit, delete and keep track of your pastes and more.

Raw Paste

Login or Register to edit or fork this paste. It's free.