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

Mikael Rittri Mikael.Rittri at carmenta.com
Wed Nov 19 10:10:28 EST 2008


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? 

Best regards,
--
Mikael Rittri
Carmenta AB
Box 11354
SE-404 28 Göteborg
Visitors: Sankt Eriksgatan 5
SWEDEN
Tel: +46-31-775 57 37
Mob: +46-703-60 34 07 
mikael.rittri at carmenta.com
www.carmenta.com

-----Original Message-----
From: fwtools-bounces at lists.maptools.org [mailto:fwtools-bounces at lists.maptools.org] On Behalf Of Mikael Rittri
Sent: den 19 november 2008 14:27
To: fwtools at lists.maptools.org
Subject: [FWTools] Problem with the GetGCPCount of GDAL wrongly returning 0for a JPG file

Hello,
I have a problem with a JPG file. 
When I apply gdalinfo, the information says that there are 16 ground control points, although their coordinate reference system is not known. I am pretty certain that they are given in WGS84 long/lat, though.  

When I try to use the JPG file in Carmenta Engine, which uses the GDAL library, there is a call to GDALPamDataset::GetGCPCount(), which calls GDALDataset::GetGCPCount(), which always returns 0.  

I expected 16, since that is what gdalinfo says.  Am I wrong in using the GetGCPCount(), or have I forgot to call some initialization method? 

By the way, gdalinfo says: 

Driver: JPEG/JPEG JFIF
Files: X:\Proj\ ... \MAL5C5MB.JPG
Size is 5756, 3767
Coordinate System is `'
GCP Projection =
GCP[  0]: Id=Pt 1, Info=
          (847,625) -> (99,7,0)
GCP[  1]: Id=Pt 2, Info=
          (844,2725) -> (99,3,0)
GCP[  2]: Id=Pt 3, Info=
          (5041,2730) -> (107,3,0)
GCP[  3]: Id=Pt 4, Info=
          (5043,629) -> (107,7,0)
GCP[  4]: Id=Pt 5, Info=
          (1892,2725) -> (101,3,0)
GCP[  5]: Id=Pt 6, Info=
          (3992,1680) -> (105,5,0)
GCP[  6]: Id=Pt 7, Info=
          (845,1676) -> (99,5,0)
GCP[  7]: Id=Pt 8, Info=
          (842,3767) -> (99,1,0)
GCP[  8]: Id=Pt 9, Info=
          (1894,1677) -> (101,5,0)
GCP[  9]: Id=Pt 10, Info=
          (2944,1679) -> (103,5,0)
GCP[ 10]: Id=Pt 11, Info=
          (5042,1681) -> (107,5,0)
GCP[ 11]: Id=Pt 12, Info=
          (3993,628) -> (105,7,0)
GCP[ 12]: Id=Pt 13, Info=
          (2945,627) -> (103,7,0)
GCP[ 13]: Id=Pt 14, Info=
          (1895,626) -> (101,7,0)
GCP[ 14]: Id=Pt 15, Info=
          (2943,2727) -> (103,3,0)
GCP[ 15]: Id=Pt 16, Info=
          (2942,3767) -> (103,1,0)
GCP[ 16]: Id=Pt 17, Info=
          (3991,2728) -> (105,3,0)

etc. etc. 

Best regards,

--
Mikael Rittri
Carmenta AB
Box 11354
SE-404 28 Göteborg
Visitors: Sankt Eriksgatan 5
SWEDEN
Tel: +46-31-775 57 37
Mob: +46-703-60 34 07
mikael.rittri at carmenta.com
www.carmenta.com

_______________________________________________
FWTools mailing list
FWTools at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/fwtools
http://fwtools.maptools.org/



More information about the FWTools mailing list