[Proj] the x, and y meaning in pj_transform
Andre Joost
andre+joost at nurfuerspam.de
Sat Oct 25 02:14:51 EST 2014
Am 25.10.2014 um 08:46 schrieb Zhang Qun:
> Dear all
>
> I have got a small question that I can not find the confirmed answer on the
> web. I am now using pj_transform to transform coordinates from svy21 to
> latlon using the following code snippet:
>
> pj_svy21 = pj_init_plus("+proj=tmerc +lat_0=1.366666666666667
> +lon_0=103.8333333333333 +k=1 +x_0=28001.642 +y_0=38744.572 +ellps=WGS84
> +units=m +no_defs")
> pj_latlong = pj_init_plus("+proj=longlat +ellps=WGS84 +datum=WGS84
> +no_defs")
>
> double svy_east = 12056.915;
> double svy_north = 37621.665;
>
> double lat_radian = svy_east;
> double lon_radian = svy_north;
> projResult = pj_transform(pj_svy21, pj_latlong, 1, 0, &lat_radian,
> &lon_radian, NULL );
>
> But the result (lat_radian, lon_radian) I got is reversed, i.e. the result
> given by
>
> pj_transform(pj_svy21, pj_latlong, 1, 0, &x, &y, NULL )
>
> is x corresponds to longitude and y corresponds to latitude. It is not
> the other way around as I did.
>
Longitude is usually East, and Latitude is North. Proj expects your data
in this order when you enter +proj=longlat.
HTH,
André Joost
More information about the Proj
mailing list