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

Florent JITIAUX fjitiaux at gmail.com
Sun Nov 27 05:54:03 EST 2011


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.

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

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

2011/11/26 Even Rouault <even.rouault at mines-paris.org>

> Le samedi 26 novembre 2011 14:21:35, Florent JITIAUX a écrit :
> > Hi,
> >
> > first thanks for all tools and bidings.
> >
> > I have a question about Gdalinfo.exe and gdal binding programs.
> > I have an USRP map but with some fields errors. When i try to load it
> with
> > the java Gdalinfo, the open failed (the dataset is null). When i use
> > gdalinfo.exe to read the map, the error mesage is the same but after
> > gdalinfo succeeds to identify the driver and get informations about the
> > map. I found the IdentyDriver method of Gdal class which is able to read
> > the driver of my map but impossible to find a way to read informations
> > with the java binding. That's why i say gdalinfo.exe is magic.
> > That's the same with Gdalbuildvrt. With the java binding it's impossible
> to
> > create a vrt because the dataset is null but it works with the .exe.
>
> There's no magic here, but it is true that Java, Python and perhaps other
> bindings will return none/null if an error is emitted in the Open() method
> of
> the driver, even if it  returned a non-null dataset. There was a rationale
> for
> this. See http://trac.osgeo.org/gdal/changeset/11529 /
> http://trac.osgeo.org/gdal/ticket/1635
>
> What should be done probably is turn the CE_Failure into a CE_Warning if
> the
> dataset opened by gdalinfo is readable. What is the *exact* error message
> you
> are seing ?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111127/a249d95e/attachment.html


More information about the gdal-dev mailing list