# [Proj] How to convert a sphere to ellipsoid with correct datum?

Hermann Peifer peifer at gmx.eu
Fri Sep 3 06:44:29 EST 2010

```  On 03/09/2010 12:52, Jan Hartmann wrote:
>  On 09/02/10 21:15, Hermann Peifer wrote:
>> On 02/09/2010 17:17, Jan Hartmann wrote:
>>>
>>> Yes, that's logical but it just doesn't work. Doing a transformation
>>> with Helmert transformation parameters set to 0 and 1 just gives
>>> results
>>> that are hundreds of meters off.
>>>
>>
>> As an exercise, I just transformed lat-lon from one ellipsoid to
>> another one by ussing the "Abridged Molodensky transformation" (EPSG
>> dataset coordinate operation method code 9605) which doesn't go the
>> long route (geographic 3D to geocentric + geocentric to geocentric +
>> geocentric to geographic 3D) but uses some sort of shortcut. Using
>> the 3 parameters dX = dY = dZ = O, I ended up with results which are
>> pretty close to those from cs2cs. 1 meter away, perhaps. So I guess
>> your hundreds of meters offset must have other reasons.
>>
>>
> That's a good hint. Could you give me the exact commands and data you
> used and their results, so I can adapt them to my situation?
>
> Jan

You posted your cs2cs results before and I get the same here:

[peifer]> cs2cs -f "%.6f" +proj=longlat +a=6376950.4 +rf=309.65
+towgs84=0,0,0 +to +proj=longlat +ellps=bessel +towgs84=0,0,0
4.8838828 51.5
4.883883        51.506347 -3.768025

The Bessel values are:

[peifer]> cs2cs -le | grep bessel
bessel a=6377397.155    rf=299.1528128   Bessel 1841

Using my molodensky_abridged script from yesterday gives:

[peifer]> awk -v parms=6376950.4,309.65,6377397.155,299.1528128 -f
molodensky_abridged.awk
4.8838828 51.5
4.883883        51.506342       -3.27222

The diff in latitude is around half a meter. There is no diff in
longitude.  And I wouldn't know why there should be a diff in longitude
when changing from one ellipsoid to another.

I could send you the awk code separately, as I doubt that there is a
general interest in it. There should also be plenty of freeware and
online converters out there.

Hermann
```