I am getting incorrect north and east values after carthographic projection using PROJ library in c++

38 Views Asked by At

I am getting incorrect north and east values after carthographic projection from global wgs84 crs(i.e., EPSG:4326) to crs Korean 1985/west belt using proj c++ library. I got an error of approx. 1.5 cm along north and east when I checked in surpad application using same parameters as below. May I know if I missing any parameters or did anything wrong?

int main()
{

    // Define the initial point
    PJ_COORD initialPoint;

    //------Korean -------
    initialPoint.lpz.lam = 127.18;
    initialPoint.lpz.phi = 37.34;
    initialPoint.lpz.z = 114.651;

    PJ *Src = proj_create(NULL, "+proj=longlat +ellps=WGS84 +datum=WGS84  +no_defs +type=crs");
    PJ *Targcopy = proj_create(NULL, "+proj=tmerc +lat_0=38 +lon_0=125 +k=1 +x_0=200000 +y_0=500000 +ellps=bessel +datum= +towgs84=125.905,-478.377,-658.757,2.166,2.284,-1.866,-1.844 +approx +units=m +no_defs +type=crs");
    auto c2c = proj_create_crs_to_crs_from_pj(NULL, Src, Targcopy, NULL, NULL);


    PJ_COORD FinalPoint = proj_trans(c2c, PJ_FWD, initialPoint);

    printf("Output 2D northing: %.3f\n easting: %.3f\n height: %.3f \n", FinalPoint.xy.y, FinalPoint.xy.x, FinalPoint.xyz.z);

    return 0;
}

input- latitude, longitude and height values with respect to wgs84 ellipsoid

output - north, east and elevation with respect to korean 1985/ west belt

0

There are 0 best solutions below