Ticket #3450 (closed defect: fixed)
OSRExportToProj4() ignores towgs84 parameters if it recognises the datum name
| Reported by: | pkelly | Owned by: | warmerdam |
|---|---|---|---|
| Priority: | high | Milestone: | 1.8.0 |
| Component: | OGR_SRS | Version: | 1.7.2 |
| Severity: | normal | Keywords: | |
| Cc: | neteler, sgamperl |
Description
A GRASS user noticed a problem whereby in a certain co-ordinate reference system manipulation using the GRASS module g.proj, towgs84 parameters he was specifying were being discarded. I've tracked this down to OSRExportToProj4() where if it recognises a datum name from the WKT it does not attempt to look for a TOWGS84 clause. There may be a good reason for this, so I submit the attached patch (against SVN) with caution.
As an example of how to reproduce the problem, consider the following WKT:
PROJCS["UTM Zone 6, Northern Hemisphere",
GEOGCS["NAD27",
DATUM["North_American_Datum_1927",
SPHEROID["Clarke 1866",6378206.4,294.978698213898,
AUTHORITY["EPSG","7008"]],
TOWGS84[-5,135,172,0,0,0,0], AUTHORITY["EPSG","6267"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4267"]],
PROJECTIONTransverse_Mercator?, PARAMETER["latitude_of_origin",0], PARAMETER["central_meridian",-147], PARAMETER["scale_factor",0.9996], PARAMETER["false_easting",500000], PARAMETER["false_northing",0], UNIT["Meter",1]]
As it is, this gets converted to:
+proj=utm +zone=6 +ellps=clrk66 +datum=NAD27 +units=m +no_defs
With the attached patch it gets converted to
+proj=utm +zone=6 +ellps=clrk66 +datum=NAD27 +towgs84=-5,135,172,0,0,0,0 +units=m +no_defs
This is more useful for our purposes anyway. I can't see any obvious side effects, but I fear I'm not aware of all the implications of this change so would not want to wholeheartedly recommend it - in particular I'm not sure how it might interact with the block of code
else if( nEPSGGeogCS != -1 ) { [...] }
and what that refers to.
But I respectfully submit it for consideration anyway! (Relevant GRASS-user message: < http://lists.osgeo.org/pipermail/grass-user/2010-March/055146.html>)
Thanks,
Paul

