[gdal-dev] help for comparing two WKT

Etienne Tourigny etourigny.dev at gmail.com
Fri Oct 7 19:36:04 EDT 2011


Hi all,

I would appreciate any hints as to how I can compare 2
WKT/OGRSpatialReference objects.

My goal is to make sure that a more detailed WKT (with authority codes
and explicit datum) corresponds (numerically) to a simpler one, such
as in the following examples.

I understand that the oSRSGDAL.exportToPrettyWkt() function can remove
AXIS, AUTHORITY and EXTENSION nodes, but how can I guarantee that the
PARAMETER nodes are in the same order? Does FixupOrdering() solve that
problem?

Furthermore, How could I compare the datums?




CF=[PROJCS["unnamed",
    GEOGCS["unknown",
        DATUM["unknown",
            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]]]

GDAL=[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"]]]



Another option is exporting to PROJ.4 strings, but there are the
+towgs84 that shows up , plus some differences in +datum vs. +ellps.

e.g.

CF=[+proj=utm +zone=55 +ellps=WGS84 +units=m +no_defs ]
GDAL=[+proj=utm +zone=55 +datum=WGS84 +units=m +no_defs ]
 or
CF=[+proj=lcc +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=134 +x_0=0 +y_0=0
+ellps=GRS80 +units=m +no_defs ]
GDAL=[+proj=lcc +lat_1=-18 +lat_2=-36 +lat_0=0 +lon_0=134 +x_0=0
+y_0=0 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs ]



many thanks,
Etienne


More information about the gdal-dev mailing list