[Geotiff] How to convert to ESRI ASCII to geotiff and vice versa?

Soon Hui Ngu soonhui.ngu at gmail.com
Thu Dec 6 00:55:21 PST 2018


*My problem statement:*


   1. Given the geotiff file, how to convert it to ESRI ASCII file?
   2. And given the ESRI ASCII file, how to convert it to geotiff?

This is how my file information looks like in ESRI ASCII:

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


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.

*How can I use the libgeotiff library to do this conversion?*

*Motivation:*

I use TauDEM  <http://hydrology.usu.edu/taudem/taudem5/index.html>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.

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-- vdraw <http://vdraw.com/>.
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.

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, I
couldn't use GDAL because using it will then require the actual ASCII file
for conversion.

Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geotiff/attachments/20181206/b3f93df9/attachment.html>


More information about the Geotiff mailing list