[gdal-dev] How to check if projections are the same?

Paul Meems bontepaarden at gmail.com
Mon Jul 25 04:07:49 EDT 2011


We use GDAL/OGR/Proj4 in our application: MapWindow GIS.

We're testing the MapWinGIS.GeoProjection class. It's just a wrapper around
OGRSpatialReference class, so it's GDAL behavior infact.

The test code:

        private void button8_Click(object sender, EventArgs e)
        {
            MapWinGIS.GeoProjection proj = new GeoProjection();
            proj.ImportFromEPSG(4326);
            System.Diagnostics.Debug.Print(proj.ExportToWKT());

            string s = proj.ExportToProj4();
            proj.ImportFromProj4(s);
            System.Diagnostics.Debug.Print(proj.ExportToWKT());

            s = proj.ExportToProj4();
            proj.ImportFromProj4(s);
            System.Diagnostics.Debug.Print(proj.ExportToWKT());
        }


Results:

GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],
AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9122"]],AUTHORITY["EPSG","4326"]]


GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]


GEOGCS["WGS
84",DATUM["unknown",SPHEROID["WGS84",6378137,298.257223563],TOWGS84[0,0,0,0,0,0,0]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]]


If we test the first and the third string with GeoProjection.IsSame() it
will return false, but they are the same.

How should we bypass this?
All suggestions are welcome.

Thanks,

Paul


 *Paul Meems *
Release manager, configuration manager
and forum moderator of MapWindow GIS.
www.mapwindow.org

Owner of MapWindow.nl - Support for
Dutch speaking users.
www.mapwindow.nl

*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20110725/1ba3edb9/attachment-0001.html


More information about the gdal-dev mailing list