[FWTools] Problem with the GetGCPCount of GDAL wrongly returning 0for a JPG file

Mikael Rittri Mikael.Rittri at carmenta.com
Thu Nov 20 06:18:11 EST 2008

Thanks for the info, Frank. That explains why gdalinfo succeeds. 
But I still don't see why our usage of GDAL in Carmenta Engine fails 
in this case.  

I think there is no code to read TAB-files in the frmts\jpeg folder, 
so I guess that this is handled by the parent class, GDALPamDataset 
in the gcore folder.  This class seems to store the TAB-file information
in a file with the extension JPG.aux.xml, but no such file is created
when I try to read my JPG-file from Carmenta Engine.  

When GDALPamDataset::GetGPCCount() is called, the struct psPam contains

  pszPamFilename	  "C:/temp/case40894/MAL5C5MB.JPG.aux.xml" 
  pszProjection	  <Bad Ptr>	
  bHaveGeoTransform	  0
  adfGeoTransform	  <unitialized values>
  nGCPCount		  0x00000000
  pasGCPList		  0x00000000

So I guess the GDALPamDataset has failed to create the file *.JPG.aux.xml.
Is this an indication of failure?  I cannot see why it is not created. 
I don't know what code is responsible for creating the aux file. 
The method GDALPamDataset::SerializeToXML() is never called,
but I cannot see from where it should be called. 

Sorry if I have strayed into too many details. But maybe someone else on 
this list have had trouble reading TAB-files for JPG-files with GDAL? 
Mikael Rittri
Carmenta AB
Box 11354
SE-404 28 Göteborg
Visitors: Sankt Eriksgatan 5
Tel: +46-31-775 57 37
Mob: +46-703-60 34 07 
mikael.rittri at carmenta.com

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: den 19 november 2008 18:01
To: Mikael Rittri
Cc: fwtools at lists.maptools.org
Subject: Re: [FWTools] Problem with the GetGCPCount of GDAL wrongly returning 0for a JPG file

Mikael Rittri wrote:
< http://lists.maptools.org/pipermail/fwtools/2008-November/001425.html > 


The JPEG driver has explicit code to use a mapinfo .tab file for georeferencing if there is no world file.  It just isn't mentioned in the documentation.  Note that this is a .tab file in a particular format used for georeferencing rasters.  The OGR mapinfo driver is not used for this though the MITAB library does end up being used to transform the coordinate system into WKT.

No magic - just undocumented features.

I'd add that there are other formats with the same behavior - at least the TIFF driver.

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 FWTools mailing list