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

Florent JITIAUX fjitiaux at gmail.com
Mon Nov 28 06:09:13 EST 2011

Hi all,

well i found the little error from my files. In fact blanks before the name
of type of the file in the header (GENERAL_INFORMATION_FILE for example)
missed. That's why i had :
ERROR 1: Unrecognised data_struct_code value G.
Field 000 initialization incorrect.
ERROR 1: Unrecognised data_type_code value E.
Field 000 initialization incorrect.

But the size of the control record was correct and size and offset of
subfields too. Then it's possible to read data after the control record.

I still have a problem to understand how gdalinfo.exe works.
In the Gdalinfo.class, if the dataset can't be read the dataset = null.
Getting the driver is done by calling the method ".GetDriver()" from the
Dataset class. Well if the dataset is null it's impossible to get the
driver. And in the Gdalinfo.class (in the Gdalinfo.c too) if the dataset is
null the program exit.
But as I say I can get the driver with "gdal.IdentifyDriver(pszFilename)".

Then, for me gdalinfo.exe is still magic.

About Qgis, I download the source to understand how it works. I found in
the GdalTools_utils.py functions that call gdalinfo with Qprocess. If I
understand correctly, this is a Qt class "used to start external programs
and to communicate with them". After Qgis get the output and splits it to
get information like information giving by gdalinfo.exe.
That's why I said Qgis use gdalinfo.exe.

There's no way to get information with bindings like gdalinfo.exe when
files contains errors ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20111128/0ad3f6c9/attachment.html

More information about the gdal-dev mailing list