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

Frank Warmerdam warmerdam at pobox.com
Wed Nov 19 12:01:03 EST 2008

Mikael Rittri wrote:
> To answer myself - partially - it turns out that my JPG file had 
> an associated TAB file, which seems to be a MapInfo TAB-file, 
> containing the ground control points.
>    If I rename the TAB-file, then gdalinfo can no longer find 
> the ground control points, so it is clear that the TAB-file 
> is the source.
> On http://www.gdal.org/frmt_jpeg.html it says that:
>     "There is currently no support for georeferencing information 
>      or metadata for JPEG files. But if an ESRI world file exists 
>      with the .jgw, .jpgw/.jpegw or .wld suffixes, it will be read 
>      and used to establish the geotransform for the image." 
> So a MapInfo TAB file would not be used for georeferencing 
> or ground control points by the GDAL library, right?
> But it is a mystery for me how gdalinfo manages to find the ground control points.
> Does gdalinfo automatically find the MapInfo TAB-file, and choose OGR as a reader 
> of the TAB file, somehow? 


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