Opened 14 years ago

Closed 9 years ago

Last modified 9 years ago

#3220 closed defect (fixed)

[PATCH] polar stereographic variant B geotiff's not supported.

Reported by: warmerdam Owned by: warmerdam
Priority: normal Milestone: 2.0.0
Component: OGR_SRS Version: unspecified
Severity: normal Keywords: gtiff
Cc:

Description

A GeoTIFF created in EPSG:3412 cannot be translated back to proj.4 with listgeo, nor is the coordinate system expanded properly with parameters in gdalinfo per:

warmerda@gdal64[493]% listgeo test.tif
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      ModelTiepointTag (2,3):
         0                0                0                
         440720           3751320          0                
      ModelPixelScaleTag (1,3):
         60               60               0                
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GTRasterTypeGeoKey (Short,1): RasterPixelIsArea
      GTCitationGeoKey (Ascii,41): "NSIDC Sea Ice Polar Stereographic South"
      GeogCitationGeoKey (Ascii,56): "Unspecified datum based upon the Hughes 1980 ellipsoid"
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      ProjectedCSTypeGeoKey (Short,1): Unknown-3412
      ProjLinearUnitsGeoKey (Short,1): Linear_Meter
      End_Of_Keys.
   End_Of_Geotiff.

PCS = 3412 (NSIDC Sea Ice Polar Stereographic South)
Projection = 19866 (US NSIDC Sea Ice polar stereographic south)
GCS: 4054/Unspecified datum based upon the Hughes 1980 ellipsoid
Datum: 6054/Not specified (based on Hughes 1980 ellipsoid)
Ellipsoid: 7058/Hughes 1980 (6378273.00,6356889.45)
Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
Projection Linear Units: 9001/metre (1.000000m)

Corner Coordinates:
Upper Left    (  440720.000, 3751320.000)
Lower Left    (  440720.000, 3750120.000)
Upper Right   (  441920.000, 3751320.000)
Lower Right   (  441920.000, 3750120.000)
Center        (  441320.000, 3750720.000)

and

warmerda@gdal64[499]% gdalinfo --debug off test.tif
Driver: GTiff/GeoTIFF
Files: test.tif
Size is 20, 20
Coordinate System is:
PROJCS["NSIDC Sea Ice Polar Stereographic South",
    GEOGCS["Unspecified datum based upon the Hughes 1980 ellipsoid",
        DATUM["Not_specified_based_on_Hughes_1980_ellipsoid",
            SPHEROID["Hughes 1980",6378273,298.279411123061,
                AUTHORITY["EPSG","7058"]],
            AUTHORITY["EPSG","6054"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4054"]],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3412"]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) 
Lower Left  (  440720.000, 3750120.000) 
Upper Right (  441920.000, 3751320.000) 
Lower Right (  441920.000, 3750120.000) 
Center      (  441320.000, 3750720.000) 
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray

Attachments (2)

test.tif (826 bytes ) - added by warmerdam 14 years ago.
sample file demonstrating problem.
libgeotiff_polarstereovariantb_ticket_3220.patch (4.1 KB ) - added by Even Rouault 14 years ago.

Download all attachments as: .zip

Change History (6)

by warmerdam, 14 years ago

Attachment: test.tif added

sample file demonstrating problem.

comment:1 by Even Rouault, 14 years ago

Summary: some polar stereographic geotiff's not supported.[PATCH] polar stereographic variant B geotiff's not supported.

The issue is that libgeotiff does not handle Polar Stereographic Variant B (EPSG 9829). Attached a temptative patch to address that.

I've searched all occurences of this projection method in projop_wparm.csv :

17275,SCAR IMW SU01-05,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-165,9102,,,,,,,,,
17276,SCAR IMW SU06-10,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-135,9102,,,,,,,,,
17277,SCAR IMW SU11-15,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-105,9102,,,,,,,,,
17278,SCAR IMW SU16-20,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-75,9102,,,,,,,,,
17279,SCAR IMW SU21-25,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-45,9102,,,,,,,,,
17280,SCAR IMW SU26-30,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-15,9102,,,,,,,,,
17281,SCAR IMW SU31-35,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,15,9102,,,,,,,,,
17282,SCAR IMW SU36-40,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,45,9102,,,,,,,,,
17283,SCAR IMW SU41-45,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,75,9102,,,,,,,,,
17284,SCAR IMW SU46-50,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,105,9102,,,,,,,,,
17285,SCAR IMW SU51-55,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,135,9102,,,,,,,,,
17286,SCAR IMW SU56-60,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,165,9102,,,,,,,,,
17287,SCAR IMW SV01-10,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-150,9102,,,,,,,,,
17288,SCAR IMW SV11-20,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-90,9102,,,,,,,,,
17289,SCAR IMW SV21-30,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,-30,9102,,,,,,,,,
17290,SCAR IMW SV31-40,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,30,9102,,,,,,,,,
17291,SCAR IMW SV41-50,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,90,9102,,,,,,,,,
17292,SCAR IMW SV51-60,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,150,9102,,,,,,,,,
17293,SCAR IMW SW01-60,9829,8806,0,9001,8807,0,9001,8832,-80.1419,9110,8833,0,9102,,,,,,,,,
19840,IBCAO Polar Stereographic,9829,8806,0,9001,8807,0,9001,8832,75,9102,8833,0,9102,,,,,,,,,
19842,Arctic Polar Stereographic,9829,8806,0,9001,8807,0,9001,8832,71,9102,8833,0,9102,,,,,,,,,
19865,US NSIDC Sea Ice polar stereographic north,9829,8806,0,9001,8807,0,9001,8832,70,9102,8833,-45,9102,,,,,,,,,
19866,US NSIDC Sea Ice polar stereographic south,9829,8806,0,9001,8807,0,9001,8832,-70,9102,8833,0,9102,,,,,,,,,
19992,Antarctic Polar Stereographic,9829,8806,0,9001,8807,0,9001,8832,-71,9102,8833,0,9102,,,,,,,,,
19993,Australian Antarctic Polar Stereographic,9829,8806,6000000,9001,8807,6000000,9001,8832,-71,9102,8833,70,9102,,,,,,,,,

So it appears that the EPSG projection parameters used for this method are :

8806,False easting
8807,False northing
8832,Latitude of standard parallel,"For polar aspect azimuthal projections, the parallel on which the scale factor is defined to be unity."
8833,Longitude of origin,"For polar aspect azimuthal projections, the meridian along which the northing axis increments and also across which parallels of latitude increment towards the north pole."

In the patch I've named the last ones that didn't exist previously as :

8832 : EPSGStdParallelLat
8833 : EPSGOriginLong

When mapping EPSGStdParallelLat to ProjNatOriginLatGeoKey and EPSGOriginLong to ProjNatOriginLongGeoKey, gdalinfo gives consistent result for EPSG:3412 and also EPSG:3032 (WGS 84 / Australian Antarctic Polar Stereographic). EPSG:3032 is interesting as I could check with the EPSG guidance 7.2 (page 55 of http://www.epsg.org/guides/docs/G7-2.pdf), that the PROJ.4 mapping of Variant B is actually correct. The patch also solves http://n2.nabble.com/is-Antarctic-Polar-Stereographic-EPSG-3031-properly-handled-by-GDAL-td3561652.html

$ gdalinfo test_ticket3220.tif
Driver: GTiff/GeoTIFF
Files: test_ticket3220.tif
Size is 20, 20
Coordinate System is:
PROJCS["NSIDC Sea Ice Polar Stereographic South",
    GEOGCS["Unspecified datum based upon the Hughes 1980 ellipsoid",
        DATUM["Not_specified_based_on_Hughes_1980_ellipsoid",
            SPHEROID["Hughes 1980",6378273,298.279411123064,
                AUTHORITY["EPSG","7058"]],
            AUTHORITY["EPSG","6054"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4054"]],
    PROJECTION["Polar_Stereographic"],
    PARAMETER["latitude_of_origin",-70],
    PARAMETER["central_meridian",0],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3412"]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) (  6d42'2.23"E, 56d 6'59.39"S)
Lower Left  (  440720.000, 3750120.000) (  6d42'9.88"E, 56d 7'35.75"S)
Upper Right (  441920.000, 3751320.000) (  6d43'7.31"E, 56d 6'55.12"S)
Lower Right (  441920.000, 3750120.000) (  6d43'14.98"E, 56d 7'31.48"S)
Center      (  441320.000, 3750720.000) (  6d42'38.60"E, 56d 7'15.44"S)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray
$ gdalinfo byte_EPSG3032.tif
Driver: GTiff/GeoTIFF
Files: byte_EPSG3032.tif
Size is 20, 20
Coordinate System is:
PROJCS["WGS 84 / Australian Antarctic Polar Stereographic",
    GEOGCS["WGS 84",
        DATUM["WGS_1984",
            SPHEROID["WGS 84",6378137,298.257223563,
                AUTHORITY["EPSG","7030"]],
            AUTHORITY["EPSG","6326"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4326"]],
    PROJECTION["Polar_Stereographic"],
    PARAMETER["latitude_of_origin",-71],
    PARAMETER["central_meridian",70],
    PARAMETER["scale_factor",1],
    PARAMETER["false_easting",6000000],
    PARAMETER["false_northing",6000000],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3032"]]
Origin = (440720.000000000000000,3751320.000000000000000)
Pixel Size = (60.000000000000000,-60.000000000000000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  INTERLEAVE=BAND
Corner Coordinates:
Upper Left  (  440720.000, 3751320.000) ( 42d 1'22.44"W, 38d27'1.75"S)
Lower Left  (  440720.000, 3750120.000) ( 42d 2'0.70"W, 38d26'49.58"S)
Upper Right (  441920.000, 3751320.000) ( 42d 1'37.92"W, 38d27'31.84"S)
Lower Right (  441920.000, 3750120.000) ( 42d 2'16.19"W, 38d27'19.67"S)
Center      (  441320.000, 3750720.000) ( 42d 1'49.31"W, 38d27'10.71"S)
Band 1 Block=20x20 Type=Byte, ColorInterp=Gray

At first, I had introduced a new value CT_PolarStereographic_B, but this may be a bit disruptive for user applications. So I've preferred to hide this detail as a hack within libgeotiff. Not sure though which approach is the best.

comment:2 by warmerdam, 14 years ago

Even,

I'm not inclined to add a new CT code if I can help it.

Ugg, I'm not too keen on adding the variantb flag into the EPSGProjMethodToCTProjMethod argument list either!

Stalling on further action for now - I think I'd want to review this more carefully than I have time for.

comment:3 by Even Rouault, 9 years ago

Milestone: 2.0
Resolution: fixed
Status: newclosed

Less invasive variant of the patch pushed in upsteam libgeotiff (http://trac.osgeo.org/geotiff/changeset/2591) and sync in GDAL in trunk r28232 "GTiff/internal libgeotiff: fix decoding of Polar Stereographic Variant B (EPSG 9829) (#3220)"

comment:4 by Even Rouault, 9 years ago

Milestone: 2.02.0.0

Milestone renamed

Note: See TracTickets for help on using tickets.