[gdal-dev] gdalwarp generating incorrect coordinates

spider plant spiderplant0 at gmail.com
Sun Dec 19 07:31:52 EST 2010


Hi, I have georeferenced an image with gdal_translate and then reprojected
it from OSGB36 to googleMaps with gdalwarp.
However the warped TIFF latitude/longitude coordinates are wrong.
The re-projection appears to stretch the map correctly, but I discovered
there was a problem when I ran gdal2tiles and the map was not aligned
correctly.

For the georeferenced file, buckland.tiff, here.....
https://docs.google.com/leaf?id=0B93lksnTC7_cNTg3OGU0MTEtNjNiMC00NWM5LTg5ZjQtMmQyNDIzNmM5NGE5

According to gdalinfo the coordinates of the lower-left corner are:
easting=241538.5, northing=119812
This corresponds to a latitude of 50.955887

I then run the warping as follows...
gdalwarp.exe -s_srs EPSG:27700 -t_srs EPSG:900913 -r cubic -of GTiff
buckland.tiff buckland_warped.tiff
..and according to gdalinfo the coordinates of the lower-left corner are:
4d15'30.51"W, 51d 8'38.06"N
I.e. a latitude of 51.143906 which is miles off (infact no latitude on the
map is near this value). It should be 50.955887.
Warped file, buckland_warped.tiff, is here....
https://docs.google.com/leaf?id=0B93lksnTC7_cNzIzZWQ0MDYtMTY5Yy00NjY0LThiMjktZjc2YzA3MmU5NjI4

When I run gdal2tiles directly on the unwarped map it does it correctly but
it is not very good quality (it doesnt seem to use such a good pixel
interpolation as gdalwarp).

Does this look like a bug in gdalwarp or am I doing something stupid.

I'm using gdal16 from osgeo4w on Windows 7 64-bit.

Output of gdalinfo on the georeferenced and warped images is below.
Thanks


BUCKLAND.TIFF...
C:\OSGeo4W\apps\gdal-16\bin>gdalinfo e:buckland.tiff
Driver: GTiff/GeoTIFF
Files: e:buckland.tiff
Size is 600, 400
Coordinate System is `'
GCP Projection = PROJCS["OSGB 1936 / British National Grid",GEOGCS["OSGB
1936",DATUM["OSGB_1936",SPHEROID["Airy 1830",63
77563.396,299.3249646000044,AUTHORITY["EPSG","7001"]],AUTHORITY["EPSG","6277"]],PRIMEM["Greenwich",0],UNIT["degree",0.01
74532925199433],AUTHORITY["EPSG","4277"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",49],PARAMETER
["central_meridian",-2],PARAMETER["scale_factor",0.9996012717],PARAMETER["false_easting",400000],PARAMETER["false_northi
ng",-100000],UNIT["metre",1,AUTHORITY["EPSG","9001"]],AUTHORITY["EPSG","27700"]]
GCP[  0]: Id=1, Info=
          (0,400) -> (241538.5,119812,0)
GCP[  1]: Id=2, Info=
          (600,0) -> (244713.5,121928.66666667,0)
GCP[  2]: Id=3, Info=
          (0,0) -> (241538.5,121928.66666667,0)
GCP[  3]: Id=4, Info=
          (600,400) -> (244713.5,119812,0)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,  400.0)
Upper Right (  600.0,    0.0)
Lower Right (  600.0,  400.0)
Center      (  300.0,  200.0)
Band 1 Block=600x3 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=600x3 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=600x3 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=600x3 Type=Byte, ColorInterp=Alpha


BUCKLAND_WARPED.TIFF...
C:\OSGeo4W\apps\gdal-16\bin>gdalinfo e:buckland_WARPED.tiff
Driver: GTiff/GeoTIFF
Files: e:buckland_WARPED.tiff
Size is 611, 419
Coordinate System is:
PROJCS["Google Maps Global Mercator",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235630016,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Mercator_1SP"],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (-474051.292871501410000,6617009.987366309400000)
Pixel Size = (8.392224865731517,-8.392224865731517)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=PIXEL
Corner Coordinates:
Upper Left  ( -474051.293, 6617009.987) (  4d15'30.51"W, 51d 9'49.57"N)
Lower Left  ( -474051.293, 6613493.645) (  4d15'30.51"W, 51d 8'38.06"N)
Upper Right ( -468923.643, 6617009.987) (  4d12'44.69"W, 51d 9'49.57"N)
Lower Right ( -468923.643, 6613493.645) (  4d12'44.69"W, 51d 8'38.06"N)
Center      ( -471487.468, 6615251.816) (  4d14'7.60"W, 51d 9'13.82"N)
Band 1 Block=611x3 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET ALPHA
Band 2 Block=611x3 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET ALPHA
Band 3 Block=611x3 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET ALPHA
Band 4 Block=611x3 Type=Byte, ColorInterp=Alpha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101219/61549b1b/attachment.html


More information about the gdal-dev mailing list