[Gdal-dev] Grid based transformation with ogr2ogr

Frank Warmerdam warmerdam at pobox.com
Wed May 10 10:52:23 EDT 2006


uwe.schmitz at lverma.nrw.de wrote:
> forgive me if I get on your nerves but...
> 
> I tried the following (this time I use GML for better reading,
> with shape files I gain the same result):
> 
> ogr2ogr -f "GML" -s_srs "+init=epsg:31467 +towgs84=631,23,451" \
>    -t_srs "+proj=utm +datum=WGS84 +zone=32" trf.xml org.xml

> and for:
> ...<gml:coordinates>3396682.3999999999,5626850.4000000004</gml:coordinates>...
> 
> in org.xml I get:
> ...<gml:coordinates>396651.68538503139,5625036.6721786009</gml:coordinates>...

Uwe,

I must appologising for not noticing/commenting on another issue.  If
you expand +init=epsg:31467 it looks like:

   +proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0
      +ellps=bessel +datum=potsdam +units=m +no_defs

The +no_defs part actually means no defaults, but it is implemented
by ignoring all items that come after it.  So I believe that the
+towgs84= clause is being ignored by one or both of ogr2ogr and
cs2cs.  To ensure you control the settings you should provide the
definition directly instead of using the +init mechanism.

eg.
    +proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0
      +ellps=bessel +towgs84=631,23,451 +units=m +no_defs

I also discovered that you do *not* want to use +datum=potsdam or
else the internal PROJ.4 towgs84 definition for potsdam will take over.

I must confess this stuff isn't as obvious as it ought to be!


> in trf.xml.
> 
> So far so good but:
> cs2cs +init=epsg:31467 +towgs84=631,23,451 \
>    +to +proj=utm +datum=WGS84 +zone=32<CR>
> 3396682.3999999999 5626850.4000000004 0.0<CR>
> 
> gives me:
> 396648.50       5625041.57 46.88
> 
> IMO cs2cs is correct.
> What's going wrong?

Right.  I have confirmed though that:

testepsg -t '+proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0 
+ellps=bessel +units=m +towgs84=631.0,23.0,451.0' '+proj=utm +datum=WGS84 
+zone=32' 3396682.3999999999 5626850.4000000004

gives the same result.  This uses the OGRSpatialReference layer, similar
to what ogr2ogr will do.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list