[Proj] ED50 from C API

Roger Oberholtzer roger at opq.se
Wed Mar 28 09:04:19 EST 2007

I would like to convert WGS84 lat/longs from a GPS receiver into
northings and eastings in ED50, fixed in UTM zone 30N. I have tried the
following, but the results are always 100-150 meters off from what I
expect. What have I missed? I based this in the ESRI file in proj 4.4.9

Initialization (error checking removed here for clarity):

        // From GPS WGS84
        fromProj = pj_init_plus( "+proj=latlong "
                                                "+ellps=WGS84 "
                                                "+towgs84=0,0,0 "

        // To ED50
        toProj   = pj_init_plus( "+proj=utm "
                                                "+ellps=intl "
                                                "+zone=30 "
                                                "+units=m "

The call for each location:

        lng = LONG * DEGREE_TO_RADIAN;
        lat = LAT  * DEGREE_TO_RADIAN;
        alt = 0; // We do not give this a height

        pj_transform(fromProj, toProj, 1, 0, &lng, &lat, &alt);

For example: 

Input WGS84: lat=37.57508059 lng=-0.93032997 alt=0.00000000

Obtains: Easting=682771.459 Northing=4160841.260

But I am expecting: Easting=682876.090 Northing=4160892.020 

There is a difference in location of 116.293 meters.

The error is in the initialization step. I suspect it is something that
is not in the ESRI file that I need to add when doing this from the C
API. But what?

Roger Oberholtzer

OPQ Systems / Ramböll RST

Ramböll Sverige AB
Kapellgränd 7
P.O. Box 4205
SE-102 65 Stockholm, Sweden

Tel: Int +46 8-615 60 20
Fax: Int +46 8-31 42 23

More information about the Proj mailing list