diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2021-09-24 17:16:28 +0200 |
|---|---|---|
| committer | Even Rouault <even.rouault@spatialys.com> | 2021-09-24 17:16:28 +0200 |
| commit | 1d6c202f9091d4f733c0824d1fcac2cec87c3a26 (patch) | |
| tree | ca5d8f99f0deffee972b59c61eabd8f2030a4a20 | |
| parent | 35fe5da17d67f793336decbc6e9280fe8f26ca8f (diff) | |
| download | PROJ-1d6c202f9091d4f733c0824d1fcac2cec87c3a26.tar.gz PROJ-1d6c202f9091d4f733c0824d1fcac2cec87c3a26.zip | |
proj_normalize_for_visualization(): set input and output units when there are several alternative transformations (fixes #2866)
| -rw-r--r-- | src/iso19111/c_api.cpp | 4 | ||||
| -rw-r--r-- | test/unit/test_c_api.cpp | 9 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/iso19111/c_api.cpp b/src/iso19111/c_api.cpp index 791d75bc..a5e1bc81 100644 --- a/src/iso19111/c_api.cpp +++ b/src/iso19111/c_api.cpp @@ -8711,6 +8711,10 @@ PJ *proj_normalize_for_visualization(PJ_CONTEXT *ctx, const PJ *obj) { if (!pjNew) return nullptr; pjNew->ctx = ctx; + pjNew->descr = "Set of coordinate operations"; + pjNew->left = obj->left; + pjNew->right = obj->right; + for (const auto &alt : obj->alternativeCoordinateOperations) { auto co = dynamic_cast<const CoordinateOperation *>( alt.pj->iso_obj.get()); diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 05e99237..dccd2fce 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3998,6 +3998,9 @@ TEST_F(CApi, proj_normalize_for_visualization) { EXPECT_EQ(std::string(projstr), "+proj=pipeline +step +proj=unitconvert +xy_in=deg +xy_out=rad " "+step +proj=utm +zone=31 +ellps=WGS84"); + + EXPECT_TRUE(proj_degree_input(Pnormalized, PJ_FWD)); + EXPECT_FALSE(proj_degree_output(Pnormalized, PJ_FWD)); } // --------------------------------------------------------------------------- @@ -4011,6 +4014,9 @@ TEST_F(CApi, proj_normalize_for_visualization_with_alternatives) { ObjectKeeper keeper_Pnormalized(Pnormalized); ASSERT_NE(Pnormalized, nullptr); + EXPECT_TRUE(proj_degree_input(Pnormalized, PJ_FWD)); + EXPECT_FALSE(proj_degree_output(Pnormalized, PJ_FWD)); + { PJ_COORD c; // Approximately Roma @@ -4057,6 +4063,9 @@ TEST_F(CApi, proj_normalize_for_visualization_with_alternatives_reverse) { ObjectKeeper keeper_Pnormalized(Pnormalized); ASSERT_NE(Pnormalized, nullptr); + EXPECT_FALSE(proj_degree_input(Pnormalized, PJ_FWD)); + EXPECT_TRUE(proj_degree_output(Pnormalized, PJ_FWD)); + PJ_COORD c; // Approximately Roma c.xyzt.x = 1789912.46264783037; |
