2012.11.21 06:33 "[Tiff] XTIFFClientOpen scheme not generating proper geotiff tags", by Oscar Kramer
I am trying to use XTIFFClientOpen in order to read and write geotiff files from within the hadoop HDFS file system. I followed the examples provided for implementing the read, write, seek, close, and other functions required. I am able to successfully open and read a geotiff from HDFS using this scheme. However, writing a geotiff image is not working properly.
The output file is missing what seem to be geotiff-specific tags, though I'm not sure (I'm comparing hex dumps of a good file against a bad). The differences are just two bytes near the very beginning of the file, namely, the offset to the first IFD. The good file has 0x0C0008 while the bad one just has 0. The only other difference is at the end of the file where the good one has about 680 bytes (starting at offset 0x0C0008) while the bad just ends at 0x0C0008. All the data in between -- which appears to be pixel data -- is identical.
I bypassed all the HDFS stuff and had my client functions read/write/seek using just the local FS to eliminate that variable and I see the same thing, so the problem is not HDFS related.
I am using the same code for populating and writing the tags as I do when interfacing to the geotiff lib using the conventional XTIFFOpen function. In both instances I'm calling GTIFWriteKeys() after populating the keys. What baffles me is that I don't see my write function being called within GTIFWriteKeys.
I suspect that the issue is with the close function not properly flushing the geo-tags. The only thing my client close function does is actually close the file -- just a one-liner with no additional writes of any kind.
Is there something special (i.e., geotiff-specific) I need to do when using XTIFFClientOpen and its i/o functions to insure the geotiff tags get written out?