以下代码是为了将 latlong 转移到日本的一个位置点的 utm。但是,utm 结果完全不正常,如下所示。有人可以帮忙吗?举个例子更好。谢谢。 ***0.607968 2.438016 -14***
#include "proj_api.h"
#include "stdio.h"
main(int argc, char **argv) {
projPJ pj_utm, pj_latlong;
double x = 34.8;
double y = 138.4;
if (!(pj_utm = pj_init_plus("+proj=utm +zone=54 +ellps=WGS84")) ){
printf("pj_init_plus error");
exit(1);
}
if (!(pj_latlong = pj_init_plus("+proj=latlong +ellps=WGS84")) ){
printf("pj_init_plus error");
exit(1);
}
x *= DEG_TO_RAD;
y *= DEG_TO_RAD;
int p = pj_transform(pj_latlong, pj_utm, 1, 1, &x, &y, NULL );
printf("%.2f\t%.2f\n", x, y);
exit(0);
}