| 2 | #include <proj.h> |
| 3 | |
| 4 | int test_transform() { |
| 5 | PJ *P; |
| 6 | PJ_COORD a, b; |
| 7 | P = proj_create_crs_to_crs( |
| 8 | PJ_DEFAULT_CTX, "EPSG:4326", |
| 9 | "+proj=utm +zone=32 +datum=WGS84", // or EPSG:32632 |
| 10 | NULL); |
| 11 | if (0 == P) { |
| 12 | std::cerr << "Oops" << std::endl; |
| 13 | return 1; |
| 14 | } |
| 15 | // Copenhagen: 55d N, 12d E |
| 16 | a = proj_coord(55, 12, 0, 0); |
| 17 | b = proj_trans(P, PJ_FWD, a); |
| 18 | std::cout.precision(2); |
| 19 | std::cout.setf(std::ios::fixed, std::ios::floatfield); |
| 20 | std::cout << "easting: " << b.enu.e << ", northing: " << b.enu.n; |
| 21 | b = proj_trans(P, PJ_INV, b); |
| 22 | std::cout << ", latitude: " << b.lp.lam << ", longitude: " << b.lp.phi |
| 23 | << std::endl; |
| 24 | proj_destroy(P); |
| 25 | return 0; |
| 26 | } |
| 27 | |
| 28 | int main(int argc, char *argv[]) { |
| 29 | PJ_INFO info; |
no test coverage detected