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

Rutger kassies at gmail.com
Fri Mar 11 02:45:29 PST 2016


Even Rouault-2 wrote
> Le vendredi 11 mars 2016 10:58:49, Rutger a écrit :
> 
>>...
> 
> This is a bit tricky. There are 2 things to consider:
> - one of the "culprit" is ImportFromProj4(). It uses a proj.4 function
> that 
> "normalizes" the proj.4 parameters, and that may have some influence on
> +datum 
> parameters being appended a +towgs84 clause  or not depending on the
> proj4. 
> version.
> I made a fix for the WGS84 case, a few months ago in trunk (so not in
> 2.0.X), 
> so as not to happen the +towgs84=0,0,0 clause :
> https://trac.osgeo.org/gdal/changeset/29775
> - the other culprit is  ExportToProj4(). Normally the default behaviour of 
> ExportToProj4() when it sees a +towgs84 node is to remove the +datum and
> let 
> only +ellps +towgs84. I don't recall precisely the reason for this, but
> this 
> behaviour can be altered by setting the OVERRIDE_PROJ_DATUM_WITH_TOWGS84
> config 
> option/environmenet variable to NO.
> 
> I've tested on GDAL 2.0.X :
> $ OVERRIDE_PROJ_DATUM_WITH_TOWGS84=NO gdalsrsinfo '+proj=aea +lat_1=20 
> +lat_2=-23 +lat_0=0 +lon_0=25 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs
> '
> 
> PROJ.4 : '+proj=aea +lat_1=20 +lat_2=-23 +lat_0=0 +lon_0=25 +x_0=0 +y_0=0 
> +datum=WGS84 +units=m +no_defs '
> 
> In trunk, no need to add OVERRIDE_PROJ_DATUM_WITH_TOWGS84=NO since due to
> the 
> first fix I mentionned ImportFromProj4() of +datum=WGS84 no longer
> generates 
> +towgs84=0,0,0 node.
> 
> Even
> 
> -- 
> Spatialys - Geospatial professional services
> http://www.spatialys.com
> _______________________________________________
> gdal-dev mailing list

> gdal-dev at .osgeo

> http://lists.osgeo.org/mailman/listinfo/gdal-dev

Even,

Thanks for fast response, setting the environment variable works very well,
so that solves it for now. In case anyone else needs this, you can set it in
Python with:
os.environ['OVERRIDE_PROJ_DATUM_WITH_TOWGS84'] = 'NO'

Which makes it valid during the Python "session", as long as python.exe is
running i guess.


Regards,
Rutger








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


More information about the gdal-dev mailing list