[Gdal-dev] Anything changed on reading Geo-Information from G eoTiff?

Frank Warmerdam warmerdam at pobox.com
Wed Nov 19 10:16:35 EST 2003


Winkler, Roland wrote:
> I debugged now GDALReadWorldFile() and I finally I found whats wrong with
> this .tfw file. The .tfw has after the 6.line containing the last
> coordintate another line containing something at the first position. If I
> remove this line everything works fine and I get the correct coordinates. I
> don't know if this .twf file is simply shitty, but on the other hand the
> older version of gdal could read it correctly 
> 
> The problem isn't the atof in GDALReadWorldFile(), it's the CPLReadLine
> which already reads this coordintates without the "-". For this 5.line the
> file pointer in *CPLFGets is positioned after the "-" an therefore it isn't
> read. If you place there any number this will be skipped, because the
> filepointer isn't corrrect. While reading the first time the file into the
> pszBuffer I saw the value -83 was read for this last position. Maybe it is
> really a problem on the different linefeeds on Linux that you can't
> reproduce.
> 
> Was anything changed on the reading from a stream recently?

Roland,

Ahh. I think this is related to the problems we have had with CPLFGets().
In late August Andrey added a CPLFGets() function, and changed CPLReadLine()
to use it.  However, the CPLFGets() didn't work properly if the file being
read was opened in text mode on win32 systems (since seeking on a text file
doesn't generally work well).

About September 12th or so I fixed the problems, largely re-implementing
CPLFGets().

Can you check your gdal/port/cpl_conv.cpp file and verify that you have
version 1.29 or more recent?  If so, you shouldn't be having problems, but it
certainly possible there are bugs in my logic.  I tried reproducing the
problem with the current CVS source and your .tfw file and was not successful.
I am not sure if that is because the linefeeds were altered "in the mail" or
whether it is because you are working with slightly out of date code that
is buggy.

If you verify that you are working with the most recent code, I would
appreciate your emailing the .tfw file to me within a zip file to preserve
it's exact contents and I will try again.

> Just tell me if you need more informations. For me it's ok now, because with
> the edited file the image works, so I didn't examine what happend in detail
> with the file pointer positions. 

If there are still bugs in the system they could strike anyone unexpectedly.
I would very much like to isolate them and fix them.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent





More information about the Gdal-dev mailing list