[gdal-dev] Gdalinfo.exe is magic, why not bindings ?

Even Rouault even.rouault at mines-paris.org
Sun Nov 27 06:05:35 EST 2011

Le dimanche 27 novembre 2011 11:54:03, Florent JITIAUX a écrit :
> n fact in the Gdalinfo.java program or in the Gdalinfo.c, if the dataset is
> null the program print the message error and call the system.exit().
> The message says there is a problem with a value (if i remember error 4)
> and the last error is "open failed -1". The message is exactly the same
> with Gdalinfo.exe
> I will check the file, maybe it's come from a wrong value in a
> controlrecord.

Hum, when I say *exact*, I really mean *exact* ... And what is interesting is 
the first error emitted by the SRP driver, not the last one in higher layers.

> I also tried to understand why this map works with Qgis but it's because
> they use the Gdalinfo.exe and get the ouput.

Not really but you're close. Qgis uses the C API directly, like gdalinfo, so 
it has not to deal with the behaviour of the Java/Python/Perl bindings that 
can turn GDAL errors into their own exception mechanism.

> As you say Ari, read files with errors is not a good thing. But the
> question for the programmer (like me) is : don't read a map if there is
> just a litlle error in one file or read a map even if there is an error but
> the raster and data like width, height and georeferencing are readable.
> In my case i have to read these maps. And i'd preffered to load it in the
> dataset java class than get informations with the gdalinfo.exe and build a
> vrt with Gdalbuildvrt.exe

Yes if the file is visually OK (is it the case here ?), then errors should 
probably reclassified as warnings.

More information about the gdal-dev mailing list