[Proj] the x, and y meaning in pj_transform

Zhang Qun zhangq.rhy at gmail.com
Sat Oct 25 01:46:32 EST 2014

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

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.

Is this the way it worked or I just used this function wrongly? Thanks.

Best regards,
Zhang Qun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/proj/attachments/20141025/97f71ffe/attachment.htm 

More information about the Proj mailing list