Opened 15 years ago

Closed 10 years ago

#11 closed defect (wontfix)

Inconsistent parameter normalization in GTIFGetDefn

Reported by: hobu Owned by: warmerdam
Priority: normal Milestone:
Component: libgeotiff Version:
Keywords: Cc:

Description

<hobu> Rosen and I are curious about the false easting ending up different
<FrankW> ouch.
<hobu> and sp1/sp2 getting messed
<FrankW> Because the PCS code is being set, all the other parameters are
essentially being ignored and the definition is recreated from the epsg
database.
<FrankW> (I think)
<FrankW> except that things are adjusted based on your request for us survey
feet instead of meters.
<hobu> so it is the person who created the geotiff keys did it incorrectly?
<FrankW> the order of the standard parallels is immaterial, so there isn't
really an issue there.
<FrankW> The input false easting is garbage.
<FrankW> It looks like the meter to foot conversion was applied twice.
<FrankW> The real value is 600000 meters.
<hobu> yay TerraScan
<hobu> largest installed base in the lidar space
<FrankW> How was the input WKT generated?
<FrankW> I see the listgeo report has an appropriate false easting, if it is
being interpreted as being in feet.
<FrankW> (I'm not sure if it should be or not)
* hobu digs through Rosen's report
<hobu> actually, the "unnamed" one is from a GTIFGetOGISDefn call where no
GDAL_DATA was enabled. That would explain its funkiness
<FrankW> OK, so the false easting error could be in GTIFGetOGISDefn() (or
libgeotiff).
<hobu> http://rafb.net/p/eoZpiS76.html is what it looks like when doing
GTIFFGetOGISDefn with a properly defined GDAL_DATA
<FrankW> well the false easting is still wrong in the WKT.
<FrankW> I'd need to do some digging to figure out if the false easting in the
listgeo result is appropriate.
<FrankW> Would you like me to look it up?
<hobu> or point me in the general direction
<FrankW> There should be some sort of faq on the geotiff site indicating if
the linear parameters are supposed to be in the linear units or not.
<hobu> http://spatialreference.org/ref/epsg/32128/prettywkt looks correct
<hobu> but that's a straight pull from the epsg database, so it should be ;)
<FrankW> right, and I confirmed that testepsg produces appropriate values.
<FrankW> ok, the geotiff faq is unhelpful in this regard.
<FrankW> Based on a weak review of geo_normalize.c I think linear parameters
in the geotiff tags are supposed to be in the linear units of the PCS.
<FrankW> So this suggests the geotiff tags are right, and the translation to
WKT is faulty.
<hobu> so we need to edit gt_wkt_srs.cpp to use the LinearUnits key for every
easting/northing? ouch
<FrankW> I'm not sure what the right solution is.
<FrankW> It would be necessary to figure out whether or not we actually get
the projection parameters from the EPSG database or not.
<hobu> sorry :)
<FrankW> It may be that the false easting was "properly" overridden from the
geotiff false easting tag but later when we overrode the linear units we
didn't realize that the false easting value was in feet, not meters.
* FrankW sighs ... so many ways for things to go wrong.
<FrankW> I'm slowly coming to the conclusion that GTIFGetDefn() is not
consistent in the form it returns linear parameters.
<FrankW> It claims to return them in meters regardless of the form in the
file, but this is only true if they are pulled from EPSG - not if they come
from the geotiff file.
<FrankW> Fixing this is going to be ... risky.
<FrankW> Ah, GTIFPrintDefn() is what you want.
<FrankW> It looks like the issue is that GTIFFFetchProjParms() does not
normalize linear units into meters so the higher level GTIFDef->WKT code does
an extra meter to foot conversion.
<FrankW> I would suggest you file a libgeotiff ticket on it.
<FrankW> Providing the input geotiff tags, and the resulting WKT should be
sufficient.
Geotiff_Information:
   Version: 1
   Key_Revision: 1.0
   Tagged_Information:
      End_Of_Tags.
   Keyed_Information:
      GTModelTypeGeoKey (Short,1): ModelTypeProjected
      GeographicTypeGeoKey (Short,1): GCS_NAD83
      GeogCitationGeoKey (Ascii,24): "GCS_North_American_1983"
      GeogGeodeticDatumGeoKey (Short,1): Datum_North_American_Datum_1983
      GeogPrimeMeridianGeoKey (Short,1): PM_Greenwich
      GeogAngularUnitsGeoKey (Short,1): Angular_Degree
      GeogAngularUnitSizeGeoKey (Double,1): 0.0174532925     
      GeogEllipsoidGeoKey (Short,1): Ellipse_GRS_1980
      GeogSemiMajorAxisGeoKey (Double,1): 6378137          
      GeogInvFlatteningGeoKey (Double,1): 298.257222       
      GeogPrimeMeridianLongGeoKey (Double,1): 0                
      ProjectedCSTypeGeoKey (Short,1): PCS_NAD83_Pennsylvania_N
      PCSCitationGeoKey (Ascii,54): "NAD_1983_StatePlane_Pennsylvania_North_FIPS_3701_Feet"
      ProjCoordTransGeoKey (Short,1): CT_LambertConfConic_2SP
      ProjLinearUnitsGeoKey (Short,1): Linear_Foot_US_Survey
      ProjLinearUnitSizeGeoKey (Double,1): 0.30480061       
      ProjStdParallel1GeoKey (Double,1): 40.8833333       
      ProjStdParallel2GeoKey (Double,1): 41.95            
      ProjNatOriginLatGeoKey (Double,1): 40.1666667       
      ProjFalseEastingGeoKey (Double,1): 1968500          
      ProjFalseNorthingGeoKey (Double,1): 0                
      ProjCenterLongGeoKey (Double,1): -77.75           
      ProjScaleAtCenterGeoKey (Double,1): 0                
      End_Of_Keys.
   End_Of_Geotiff.

PCS = 32128 (NAD83 / Pennsylvania North)
Projection = 13731 (SPCS83 Pennsylvania North zone (meters))
Projection Method: CT_LambertConfConic_2SP
   ProjFalseOriginLatGeoKey: 40.166667 ( 40d10' 0.00"N)
   ProjFalseOriginLongGeoKey: -77.750000 ( 77d45' 0.00"W)
   ProjStdParallel1GeoKey: 40.883333 ( 40d53' 0.00"N)
   ProjStdParallel2GeoKey: 41.950000 ( 41d57' 0.00"N)
   ProjFalseEastingGeoKey: 1968500.000000 m
   ProjFalseNorthingGeoKey: 0.000000 m
GCS: 4269/NAD83
Datum: 6269/North American Datum 1983
Ellipsoid: 7019/GRS 1980 (6378137.00,6356752.31)
Prime Meridian: 8901/Greenwich (0.000000/  0d 0' 0.00"E)
Projection Linear Units: 9003/US survey foot (0.304801m)

PROJCS["NAD83 / Pennsylvania North",
    GEOGCS["NAD83",
        DATUM["North_American_Datum_1983",
            SPHEROID["GRS 1980",6378137,298.2572221010002,
                AUTHORITY["EPSG","7019"]],
            AUTHORITY["EPSG","6269"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4269"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",40.88333333333333],
    PARAMETER["standard_parallel_2",41.95],
    PARAMETER["latitude_of_origin",40.16666666666666],
    PARAMETER["central_meridian",-77.75],
    PARAMETER["false_easting",6458320.416666665],
    PARAMETER["false_northing",0],
    UNIT["US survey foot",0.3048006096012192,
        AUTHORITY["EPSG","9003"]],
    AUTHORITY["EPSG","32128"]]

Change History (1)

comment:1 by hobu, 10 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.