Opened 13 years ago

Closed 13 years ago

#4281 closed defect (invalid)

OGRSpatialReference::IsSameGeogCS() does not check for "unknown" datum values

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

Description

When a datum with value "unknown" is compared to a known datum with same spheroid(numerically), IsSameGeogCS() returns false.

The following one-liner fix resolves the problem:

     if( pszThisValue != NULL && pszOtherValue != NULL 
+        && !EQUAL(pszThisValue,"unknown") && !EQUAL(pszOtherValue,"unknown")
         && !EQUAL(pszThisValue,pszOtherValue) )
         return FALSE;

Example WKT illustrating the problem:

PROJCS["unnamed",
    GEOGCS["unknown",
        DATUM[,
            SPHEROID["Spheroid",6378137,298.2572221010002]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",-18],
    PARAMETER["standard_parallel_2",-36],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",134],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0]]
PROJCS["GDA94 / Geoscience Australia Lambert",
    GEOGCS["GDA94",
        DATUM["Geocentric_Datum_of_Australia_1994",
            SPHEROID["GRS 1980",6378137,298.2572221010002,
                AUTHORITY["EPSG","7019"]],
            TOWGS84[0,0,0,0,0,0,0],
            AUTHORITY["EPSG","6283"]],
        PRIMEM["Greenwich",0],
        UNIT["degree",0.0174532925199433],
        AUTHORITY["EPSG","4283"]],
    PROJECTION["Lambert_Conformal_Conic_2SP"],
    PARAMETER["standard_parallel_1",-18],
    PARAMETER["standard_parallel_2",-36],
    PARAMETER["latitude_of_origin",0],
    PARAMETER["central_meridian",134],
    PARAMETER["false_easting",0],
    PARAMETER["false_northing",0],
    UNIT["metre",1,
        AUTHORITY["EPSG","9001"]],
    AUTHORITY["EPSG","3112"]]

Change History (1)

comment:1 by etourigny, 13 years ago

Resolution: invalid
Status: newclosed

It seems that named datums also imply a set of comtrol points on the spheroid, so two datums are not strictly equal if the spheroid parameters are the same.

See http://lists.osgeo.org/pipermail/gdal-dev/2011-October/030392.html http://www.unidata.ucar.edu/mailing_lists/archives/netcdf-java/2011/msg00024.html

Therefore closing this bug as invalid.

Note: See TracTickets for help on using tickets.