MCPcopy Create free account
hub / github.com/OSGeo/PROJ / test_transform

Function test_transform

test/postinstall/cpp_app/cpp_app.cpp:4–26  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2#include <proj.h>
3
4int 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
28int main(int argc, char *argv[]) {
29 PJ_INFO info;

Callers 1

mainFunction · 0.70

Calls 4

proj_create_crs_to_crsFunction · 0.85
proj_coordFunction · 0.85
proj_transFunction · 0.85
proj_destroyFunction · 0.85

Tested by

no test coverage detected