Opened 21 years ago

Last modified 21 years ago

#252 closed defect (worksforme)

GDAL gets southern UTM coordinates wrong (EPSG)

Reported by: Markus Neteler Owned by: warmerdam
Priority: high Milestone:
Component: default Version: unspecified
Severity: normal Keywords:
Cc:

Description

Hi Frank,

I have the impression that GDAL gets UTM coordinates on southern
hemisphere wrong. I was using LANDSAT-TM5 data from Botswana which
is UTM zone 34S.

ftp://ftp.glcf.umiacs.umd.edu/glcf/Landsat/WRS2/p174/r073/p174r73_5t900416.TM-EarthSat-Orthorectified/
p174r73_5t900416_nn1.tif.gz
gdalinfo p174r73_5t900416_nn1.tif
Driver: GTiff/GeoTIFF
Size is 8191, 7172
Coordinate System is:
PROJCS["WGS 84 / UTM zone 34N",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.2572235629972,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    AUTHORITY["EPSG","32634"],
    PROJECTION["Transverse_Mercator"],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",21],
    PARAMETER["scale_factor",0.9996],
    PARAMETER["false_easting",500000],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]]]
Origin = (701128.500000,-1977985.500000)
Pixel Size = (28.500000,-28.500000)
Corner Coordinates:
Upper Left  (  701128.500,-1977985.500) ( 22d53'54.03"E, 17d52'49.72"S)
Lower Left  (  701128.500,-2182387.500) ( 22d55'9.01"E, 19d43'36.50"S)
Upper Right (  934572.000,-1977985.500) ( 25d 5'55.19"E, 17d50'47.82"S)
Lower Right (  934572.000,-2182387.500) ( 25d 8'36.64"E, 19d41'21.06"S)
Center      (  817850.250,-2080186.500) ( 24d 0'54.24"E, 18d47'20.73"S)
Band 1 Block=8191x1 Type=Byte, ColorInterp=Gray
  Overviews: 1024x897

The GRASS definition for this area is (boundary only approximately):
g.region rast=markveggy.shp.recl -p
projection: 1 (UTM)
zone:       -35
datum:      ** unknown (default: WGS84) **
ellipsoid:  wgs84
north:      8038290
south:      7802760
west:       101850
east:       360510
nsres:      30
ewres:      30
rows:       7851
cols:       8622

GDAL should report EPSG 32734 instead of EPSG 32634.
Or are the data tags corrupted (then NASA, GLCF makes it wrong!)?

Thanks,

 Markus

Change History (2)

comment:1 by neteler@…, 21 years ago

Frank,

while trying to find a quick solution for me, I have thought of 'gdalwarp'
to warp the from UTM34N to UTM34S:

gdalinfo p174r73_5t900416_nn1.tif | grep EP
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        AUTHORITY["EPSG","4326"]],
    AUTHORITY["EPSG","32634"],             <---- ! UTM 34 N
        AUTHORITY["EPSG","9001"]]]

Perhaps GDAL is right on that and the data are wrong. Anyway, here
the warping:

gdalwarp -s_srs EPSG:32634 -t_srs EPSG:32734 p174r73_5t900416_nn1.tif
p174r73_5t900416_nn1_UTM34S.tif
Creating output file is that 8191P x 7172L.
:0...10...20...30...40...50...60...70...80...90...100 - done.

gdalinfo p174r73_5t900416_nn1_UTM34S.tif
Driver: GTiff/GeoTIFF
Size is 8191, 7172
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 7172.0)
Upper Right ( 8191.0,    0.0)
Lower Right ( 8191.0, 7172.0)
Center      ( 4095.5, 3586.0)
Band 1 Block=8191x1 Type=Byte, ColorInterp=Gray

-> It "eats" the coordinate system, only XY coordinates are left
over...silently. Is that a bug or feature?


Then I thought it doesn't make sense to specify -s_srs EPSG:32634
as the data set already contains this information:

gdalwarp -t_srs EPSG:32734 p174r73_5t900416_nn1.tif    
p174r73_5t900416_nn1_UTM34S.tif
:0...10...20...ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: latitude or longitude exceeded limits
ERROR 1: Reprojection failed, err = -14, further errors will be supressed on the
transform object.
30...40...50...60...70...80...90...100 - done.

Also this leads to (only) XY coordinates.

Kind regards

 Markus

comment:2 by warmerdam, 21 years ago

Markus,

Both of the things you did worked fine for me.  The writing of the
output SRS was implemented Dec 17 in gdalwarp.c, perhaps you didn't have it.

Note: See TracTickets for help on using tickets.