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

jerome at georezo.net jerome at georezo.net
Tue Apr 27 02:41:38 EDT 2010


Some metadata are different, but it is the same coordinate system. The IsSame function may compare the OGRSpatialReference and not the specific coordinate system data. So the solution to this problem may be to test a conversion between the two coordinate systems AND verify that coordinates don't move.


---
Jérôme

----- Mail Original -----
De: "atubar" <atubar at 126.com>
À: gdal-dev at lists.osgeo.org
Envoyé: Mardi 27 Avril 2010 07h42:28 GMT +01:00 Amsterdam / Berlin / Berne / Rome / Stockholm / Vienne
Objet: [gdal-dev] how to compare two  OGRSpatialReference  is same?




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? 


有域名马上来,网易免费送你200户自主域名邮箱 
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/gdal-dev


More information about the gdal-dev mailing list