全文预览

地图投影变换开源包proj4

上传者:相惜 |  格式:ppt  |  页数:21 |  大小:50KB

文档介绍
J pj ); Р释放projPJ结构内存Р#include <proj_api.h>Р main(int argc, char **argv) {? projPJ pj_merc, pj_latlong;? double x, y;Р if (!(pj_merc = pj_init_plus("+proj=merc +ellps=clrk66 +lat_ts=33")) )? exit(1);? if (!(pj_latlong = pj_init_plus("+proj=latlong +ellps=clrk66")) )? exit(1);? while (scanf("%lf %lf", &x, &y) == 2) {? x *= DEG_TO_RAD;? y *= DEG_TO_RAD;? p = pj_transform(pj_latlong, pj_merc, 1, 1, &x, &y, NULL );? printf("%.2f\t%.2f\n", x, y);? }? exit(0);? }Р#include <proj_api.h>Р int main(int argc, char **argv) {? char *args[] = { "proj=merc", "ellps=clrk66", "lat_ts=33" };? projUV p;? projPJ pj;Р if (!(pj = pj_init(3, args)))? exit(1);? while (scanf("%lf %lf", &p.v, &p.u) == 2) {? p.u *= DEG_TO_RAD;? p.v *= DEG_TO_RAD;? p = pj_fwd(p, pj);? printf("%.2f\t%.2f\n", p.u, p.v);? }? exit(0);? }

收藏

分享

举报
下载此文档