Opened 18 years ago

Last modified 17 years ago

#1184 closed defect (fixed)

Reprojection doesn't deal with +nadgrids

Reported by: uwe.schmitz@… Owned by: warmerdam
Priority: high Milestone:
Component: OGR_SRS Version: unspecified
Severity: normal Keywords:
Cc: Markus Neteler

Description

Ogr2ogr (the same for gdal_warp, I believe)
doesn't handle +nadgrids="..." switch for 
datum shifts, e.g in:

ogr2ogr -f "GML" \
   -s_srs "+proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0
+ellps=bessel +nadgrids=DHDN_ETRS89.gsb +units=m" \
   -t_srs "+proj=utm +datum=WGS84 +zone=32" trf.xml org.xml

the grid is ignored.

Change History (5)

comment:1 by warmerdam, 18 years ago

So the fundamental problem is that the OGC WKT representation used as the core
GDAL/OGR coordinate system format does not include a mechanism to represent
use of external grid files. 

I think my desired solution to this would be to add an EXTENSION keyword
on the datum with the keyname "GRIDLIST", and the list of grids as the value.
This will make the OGC WKT non-standard, so before doing this I would like to 
add some logic to ensure it is "cleaned out" in appropriate circumstances, 
such as when doing a morphToESRI(). 


comment:2 by warmerdam, 17 years ago

Uwe,

I've made an addition to the OGRSpatialReference that show allow preserving
exact PROJ.4 syntax in the intermediate wkt representation as an extension
node. 

Could you try something like:

ogr2ogr -f "GML" \
   -s_srs "+proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0
+ellps=bessel +nadgrids=DHDN_ETRS89.gsb +units=m +wktext" \
   -t_srs "+proj=utm +datum=WGS84 +zone=32" trf.xml org.xml

Note the addition of +wktext to the proj.4 definition with the nadgrids
definition.  

The code changes should have been in GDAL 1.4.0, or you could test 
with a recent FWTools release. 


comment:3 by warmerdam, 17 years ago

Adjusted component to OGR_SRS.

comment:4 by uwe.schmitz@…, 17 years ago

(In reply to comment #2)
Frank,

> Could you try something like:
> 
> ogr2ogr -f "GML" \
>    -s_srs "+proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0
> +ellps=bessel +nadgrids=DHDN_ETRS89.gsb +units=m +wktext" \
>    -t_srs "+proj=utm +datum=WGS84 +zone=32" trf.xml org.xml
> 
> Note the addition of +wktext to the proj.4 definition with the nadgrids
> definition.  
> 
Works with FWTools1.2.0!!

I had problems specifying the grid file under windows. The 
program always looked it up under <FWToolsInstallDir>/proj_lib.
I haven't found a way to specify an other place.
Even absolute paths are appended to the above
mentioned installation path. Setting PROJ_DEBUG was
a great help for finding this out.

Thank you very much, Frank!!

comment:5 by warmerdam, 17 years ago

Uwe,

Could you file a bug against PROJ.4 about the absolute paths not working, with
some detailed examples of forms that did not work. 

The pj_open_lib() function attempts to recognise absolute paths, but I 
see it does not recognise drive name prefixes, and on windows it will only
recognise \ as a path sep. not /. 

I'll try and improve this before the next PROJ.4 release. 

At some point I may consider adding special cases of the PROJ.4 to WKT
translation where the need to preserve the original PROJ.4 string is
recognised.  But I hesitate to go there quite yet. 
Note: See TracTickets for help on using tickets.