[gdal-dev] how to compare two OGRSpatialReference is same?

atubar atubar at 126.com
Tue Apr 27 01:42:28 EDT 2010


Hello, I write some code below to compare OGRSpatialReference,

bool CompareWktIsUniform(const char* pszWkt1, const char* pszWkt2)
{
 OGRSpatialReference SR1(pszWkt1);
 OGRSpatialReference SR2(pszWkt2);

 int IsSame = SR1.IsSame(&SR2);

 if (IsSame == TRUE)
  return  true;
 else
  return false;
}

And  I have two  OGRSpatialReference, one is from shapefile and the other is from Geotiff. 

PROJCS["Albers Conical Equal Area",GEOGCS["GCS_Krasovsky_1940",DATUM["Krasovsky_1940",SPHEROID["Krasovsky_1940",6378245.0,298.3]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["False_Easting",0.0],PARAMETER["False_Northing",0.0],PARAMETER["longitude_of_center",105.0],PARAMETER["Standard_Parallel_1",25.0],PARAMETER["Standard_Parallel_2",47.0],PARAMETER["latitude_of_center",0.0],UNIT["Meter",1.0]]


PROJCS["IMAGINE GeoTIFF Support
Copyright 1991 - 2005 by Leica Geosystems Geospatial Imaging, LLC. All Rights Reserved
@(#)$RCSfile: egtf.c $ IMAGINE 9.0 $Revision: 10.0 $ $Date: 2005/07/26 15:10:00 EST $
Projection = Albers Conical Equal Area",GEOGCS["Krasovsky",DATUM["Krasovsky",SPHEROID["Krasovsky",6378245,298.3000003760163]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["standard_parallel_1",25],PARAMETER["standard_parallel_2",47],PARAMETER["latitude_of_center",0],PARAMETER["longitude_of_center",105],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["metre",1,AUTHORITY["EPSG","9001"]]]

But they are recognized the same in ArcGis and Erdas, in ArcGis they are both shown as below:

Projection: Albers
False_Easting: 0.000000
False_Northing: 0.000000
Central_Meridian: 105.000000
Standard_Parallel_1: 25.000000
Standard_Parallel_2: 47.000000
Latitude_Of_Origin: 0.000000
Linear Unit: Meter (1.000000)

Geographic Coordinate System: GCS_Krasovsky_1940
Angular Unit: Degree (0.017453292519943299)
Prime Meridian: Greenwich (0.000000000000000000)
Datum: D_Krasovsky_1940
  Spheroid: Krasovsky_1940
    Semimajor Axis: 6378245.000000000000000000
    Semiminor Axis: 6356863.018773047300000000
    Inverse Flattening: 298.300000000000010000

So, is there any way to get the same results? or what is lost?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100427/5d66eb1f/attachment.html


More information about the gdal-dev mailing list