Raster Format Conversion Using gdal translate: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 57:
<pre>gdal_translate.exe -of EHdr DEM_M01_5m.tif DEM_M01_5m.flt</pre>
<li> The output ".flt" is identical to the "FLT" supported by TUFLOW so no updates to this file are required. The ".hdr" however is slightly different and requires manual updating.<br>
<br>
The output ".hdr" will look something like below:<br>
<pre>
Line 82 ⟶ 83:
cellsize <decimal no.>
NODATA_value <decimal no.>
byteorder LSBFIRST
</pre>
The conversion is a mostly a matter of renaming the header text (it should not be case sensitive in TUFLOW). There is one exception to this, the "tie-point" is different in the "EHdr" format. It is referencing the middle of the top-left cell, whereas the "FLT" format supported in TUFLOW expects the lower-left corner (similar to the ASC format).<Br>
[[File: ehdr_flt_tie_point_comparison.PNG]]<Br>
<br>
Therefore the following conversions are required:
<pre>xllcorner = ULXMAP - (XDIM / 2)</pre>
<pre>yllcorner = ULYMAP - (NROW * YDIM) + (YDIM / 2)</pre>
If using the ".hdr" created by gdal_translate.exe from above, the resulting converted "TUFLOW Supported .hdr" will look like:<Br>
<Br>
<pre>
ncols 1895
nrows 2137
xllcorner 292786.25
yllcorner 6177386.25
cellsize 0.5
NODATA_value -9999
byteorder LSBFIRST
</pre>