[Gdal-dev] Comparing Barely-Different SpatialRef Objects with .IsSame

Christopher Michaelis cmichaelis at happysquirrel.com
Fri Oct 14 19:04:49 EDT 2005


Hi there,

I'm trying to compare two proj4 strings by loading each one into an 
OGRSpatialReference object using .ImportFromProj4(), then comparing them 
using .IsSame().

The problem that's arising is that the two are just barely off 
(.0000000001 off on the y_0 parameter). Therefore, .IsSame() is 
returning false.

So, my question for the crowd is, how can I detect this condition and 
actually catch these two as equivalent?

The two strings in question are:
"+proj=lcc +lat_1=38.33333333333334 +lat_2=39.83333333333334 
+lat_0=37.66666666666666 +lon_0=-122 +x_0=2000000 +y_0=500000.0000000001 
+ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs"

"+proj=lcc +lat_1=38.33333333333334 +lat_2=39.83333333333334 
+lat_0=37.66666666666666 +lon_0=-122 +x_0=2000000 +y_0=500000.0000000002 
+ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs"

Any thoughts? BTW, I'm using GDAL 1.3.0.

Thanks,
Chris Michaelis
cmichaelis at happysquirrel.com





More information about the Gdal-dev mailing list