[gdal-dev] Comparing two SRS's, different Proj4

Rutger kassies at gmail.com
Fri Mar 11 01:58:49 PST 2016


Dear list,

I am trying to compare 2 different projections using OSR in Python. One SRS
is initialized from a proj4 string given by PostGIS. It's a custom
definition, so using EPSG is unfortunately not an option.

The other SRS is read from a Geotiff raster using GDAL, so initialized via
Wkt from ds.GetProjection(). 

My method of comparing is maybe a bit naive, i tried:
srs1.ExportToProj4() == srs2.ExportToProj4()

If there something better i'd be happy to hear. 

The problem is however that both ExportToWkt() statements return a different
string. The one initialized from Wkt defines the datum as "+datum=WGS84",
which is identical to running "gdalinfo -proj4" and i assume this is
correct.

The other srs changes this to "+ellps=WGS84 +towgs84=0,0,0,0,0,0,0". 

Here is a notebook replicating the behavior, but without using a raster:
https://gist.github.com/RutgerK/e4e40b1025f7279af430

Why is the ExportToProj4() different then the string from which it was
initialized? 

A workaround for me would be to first read the Wkt from the raster and
initialize a srs-object, export from that object to proj4 and use that to
initialize a new srs-object and go from there. That doesn't seem right
though, so would be happy if someone can point me in the right direction. 


Regards,
Rutger



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/Comparing-two-SRS-s-different-Proj4-tp5255792.html
Sent from the GDAL - Dev mailing list archive at Nabble.com.


More information about the gdal-dev mailing list