<div dir="ltr"><div style="color:rgb(33,33,33);font-size:13px"><b><font size="4">My problem statement:</font></b></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style=""><ol style="color:rgb(33,33,33);font-size:13px"><li>Given the geotiff file, how to convert it to ESRI ASCII file?</li><li>And given the ESRI ASCII file, how to convert it to geotiff?</li></ol>This is how my file information looks like in ESRI ASCII:</div><div style=""><br></div><div style=""><pre style="margin-top:0px;margin-bottom:1em;padding:5px;border:0px;font-variant-numeric:inherit;font-variant-east-asian:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;font-size:13px;vertical-align:baseline;box-sizing:inherit;width:auto;max-height:600px;overflow:auto;background-color:rgb(239,240,241);color:rgb(36,39,41)"><code style="margin:0px;padding:0px;border:0px;font-style:inherit;font-variant:inherit;font-weight:inherit;font-stretch:inherit;line-height:inherit;font-family:Consolas,Menlo,Monaco,"Lucida Console","Liberation Mono","DejaVu Sans Mono","Bitstream Vera Sans Mono","Courier New",monospace,sans-serif;vertical-align:baseline;box-sizing:inherit;white-space:inherit">ncols         5 
nrows         4 
xllcorner     0 
yllcorner     0 
cellsize      10 
NODATA_value  -9999 
25.4 26.1 27 28.6 27.7
25 26 26.4 27.9 27.4
25.1 25.8 26.8 28.6 27.6
27.5 28 27.7 30.6 28.3</code></pre></div><div style=""><br></div><div style="">No georeferencing data, no metadata, just grid information with the z value-- with z value being the drain number where the cell is draining to.</div><div style=""><br></div><div style=""><i>How can I use the libgeotiff library to do this conversion?</i></div><div style=""><br><div style="color:rgb(33,33,33);font-size:13px"><b><font size="4">Motivation:</font></b></div><div style="color:rgb(33,33,33);font-size:13px"><br></div><div style="color:rgb(33,33,33)"><div style="font-size:13px">I use <a href="http://hydrology.usu.edu/taudem/taudem5/index.html" target="_blank">TauDEM </a>in my application for catchment delineation, and TauDEM uses raster file ( in the form of geotiff/ASCII) as input, and outputs the catchment delineation result in geotiff format. </div><div style="font-size:13px"><br></div><div style="font-size:13px">I have my mesh from analysis, that I will need to convert to geotiff file for TauDEM for processing. When TauDEM finishes the work and outputs the result in geotiff format, I would need to read it into the memory in my code and render it using my own rendering engine-- <a href="http://vdraw.com/" target="_blank">vdraw</a>. If I know how to convert between geotiff and ASCII file, I can immediately go from mesh to geotiff file without the intermediate ASCII ( which is very wasteful); likewise, if I know how to take the output geotiff and convert it to ASCII, I can process the geotiff file in memory and render it much faster without convert it to file in ASCII format. </div><div style="font-size:13px"><br></div><div style="">This is why I need to know how to use libgeotiff ( or any other library) to do the conversion-- because my ESRI ASCII "file" lives in the memory and not hard disk.  Even though GDAL contains such a conversion utility method, <span style="font-size:13px">I couldn't use GDAL because using it will then require the actual ASCII file for conversion.</span></div><div style=""><span style="font-size:13px"><br></span></div><div style=""><span style="font-size:13px">Any ideas?</span></div></div></div></div>