diff options
| author | Even Rouault <even.rouault@spatialys.com> | 2019-07-02 10:47:33 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-07-02 10:47:33 +0200 |
| commit | 3ae09c3ba164728e200a3b930b72ed5fc24ef6ee (patch) | |
| tree | 72ae697f3fa40cb573db91629c8ad30ab657f03c /test | |
| parent | fb8228a938df79416329956164c76dae2023b0be (diff) | |
| parent | 74932008096b3135317d8c45cb9c9fabb5ab8c6b (diff) | |
| download | PROJ-3ae09c3ba164728e200a3b930b72ed5fc24ef6ee.tar.gz PROJ-3ae09c3ba164728e200a3b930b72ed5fc24ef6ee.zip | |
Merge pull request #1537 from rouault/add_scope_remarks_for_coordinate_operation
Database: import scope/remarks for coordinate operation and add C API
Diffstat (limited to 'test')
| -rw-r--r-- | test/cli/testprojinfo_out.dist | 18 | ||||
| -rw-r--r-- | test/unit/test_c_api.cpp | 114 | ||||
| -rw-r--r-- | test/unit/test_factory.cpp | 17 |
3 files changed, 136 insertions, 13 deletions
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist index 4c0e726d..f742fa60 100644 --- a/test/cli/testprojinfo_out.dist +++ b/test/cli/testprojinfo_out.dist @@ -279,7 +279,7 @@ COORDINATEOPERATION["NAD27 to NAD83 (3)", PARAMETERFILE["Latitude and longitude difference file","ntv1_can.dat"], OPERATIONACCURACY[1.0], USAGE[ - SCOPE["unknown"], + SCOPE["Historic record only - now superseded - see remarks."], AREA["Canada"], BBOX[40.04,-141.01,86.46,-47.74]], ID["DERIVED_FROM(EPSG)",1312]] @@ -329,7 +329,7 @@ COORDINATEOPERATION["NAD27 to NAD83 (4)", PARAMETERFILE["Latitude and longitude difference file","ntv2_0.gsb"], OPERATIONACCURACY[1.5], USAGE[ - SCOPE["unknown"], + SCOPE["Accuracy 1-2 metres."], AREA["Canada - NAD27"], BBOX[40.04,-141.01,83.17,-47.74]], ID["DERIVED_FROM(EPSG)",1313]] @@ -378,7 +378,7 @@ COORDINATEOPERATION["NAD27 to NAD83 (1)", PARAMETERFILE["Latitude and longitude difference file","conus"], OPERATIONACCURACY[0.15], USAGE[ - SCOPE["unknown"], + SCOPE["Accuracy at 67% confidence level is 0.15m onshore, 5m nearshore and undetermined farther offshore."], AREA["USA - CONUS including EEZ"], BBOX[23.81,-129.17,49.38,-65.69]], ID["DERIVED_FROM(EPSG)",1241]] @@ -427,7 +427,7 @@ COORDINATEOPERATION["NAD27 to NAD83 (2)", PARAMETERFILE["Latitude and longitude difference file","alaska"], OPERATIONACCURACY[0.5], USAGE[ - SCOPE["unknown"], + SCOPE["Accuracy at 67% confidence level is 0.5m onshore, 5m nearshore and undetermined farther offshore."], AREA["USA - Alaska including EEZ"], BBOX[47.88,167.65,74.71,-129.99]], ID["DERIVED_FROM(EPSG)",1243]] @@ -478,10 +478,11 @@ COORDINATEOPERATION["NAD27 to NAD83 (5)", PARAMETERFILE["Latitude and longitude difference file","GS2783v1.QUE"], OPERATIONACCURACY[1.0], USAGE[ - SCOPE["unknown"], + SCOPE["Historic record only - now superseded - see remarks."], AREA["Canada - Quebec"], BBOX[44.99,-79.85,62.62,-57.1]], - ID["EPSG",1462]] + ID["EPSG",1462], + REMARK["Densification for Quebec of code 1312. Replaced by NAD27 to NAD83 (6) (code 1573). Uses NT method which expects longitudes positive west; EPSG GeogCRSs NAD27 (code 4267) and NAD83 (code 4269) have longitudes positive east."]] ------------------------------------- Operation n°6: @@ -529,10 +530,11 @@ COORDINATEOPERATION["NAD27 to NAD83 (6)", PARAMETERFILE["Latitude and longitude difference file","QUE27-83.gsb"], OPERATIONACCURACY[1.5], USAGE[ - SCOPE["unknown"], + SCOPE["Accuracy 1-2 metres."], AREA["Canada - Quebec"], BBOX[44.99,-79.85,62.62,-57.1]], - ID["EPSG",1573]] + ID["EPSG",1573], + REMARK["Replaces NAD27 to NAD83 (5) (code 1462). Uses NT method which expects longitudes positive west; EPSG GeogCRSs NAD27 (code 4267) and NAD83 (code 4269) have longitudes positive east."]] ------------------------------------- Operation n°7: diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp index 2e6ea2c7..82974e13 100644 --- a/test/unit/test_c_api.cpp +++ b/test/unit/test_c_api.cpp @@ -3375,4 +3375,118 @@ TEST_F(CApi, proj_normalize_for_visualization_with_alternatives_reverse) { EXPECT_NEAR(c.lp.phi, 42, 1e-8); } +// --------------------------------------------------------------------------- + +TEST_F(CApi, proj_get_remarks) { + auto co = proj_create_from_database(m_ctxt, "EPSG", "8048", + PJ_CATEGORY_COORDINATE_OPERATION, false, + nullptr); + ObjectKeeper keeper(co); + ASSERT_NE(co, nullptr); + + auto remarks = proj_get_remarks(co); + ASSERT_NE(remarks, nullptr); + EXPECT_EQ( + remarks, + std::string("Scale difference in ppb where 1/billion = 1E-9. " + "Derivation excluded Cocos, Christmas and Macquarie " + "Islands but is applied there. See codes 8444-46 for " + "equivalents using NTv2 method. See code 8447 for " + "alternative including distortion model for Aus only.")); +} + +// --------------------------------------------------------------------------- + +TEST_F(CApi, proj_get_scope) { + { + auto co = proj_create_from_database(m_ctxt, "EPSG", "8048", + PJ_CATEGORY_COORDINATE_OPERATION, + false, nullptr); + ObjectKeeper keeper(co); + ASSERT_NE(co, nullptr); + + auto scope = proj_get_scope(co); + ASSERT_NE(scope, nullptr); + EXPECT_EQ(scope, + std::string("Conformal transformation of GDA94 coordinates " + "that have been derived through GNSS CORS.")); + } + { + auto P = proj_create(m_ctxt, "+proj=noop"); + ObjectKeeper keeper(P); + ASSERT_NE(P, nullptr); + auto scope = proj_get_scope(P); + ASSERT_EQ(scope, nullptr); + } +} + +// --------------------------------------------------------------------------- + +TEST_F(CApi, proj_concatoperation_get_step) { + // Test on a non concatenated operation + { + auto co = proj_create_from_database(m_ctxt, "EPSG", "8048", + PJ_CATEGORY_COORDINATE_OPERATION, + false, nullptr); + ObjectKeeper keeper(co); + ASSERT_NE(co, nullptr); + ASSERT_NE(proj_get_type(co), PJ_TYPE_CONCATENATED_OPERATION); + + ASSERT_EQ(proj_concatoperation_get_step_count(m_ctxt, co), 0); + ASSERT_EQ(proj_concatoperation_get_step(m_ctxt, co, 0), nullptr); + } + // Test on a concatenated operation + { + auto ctxt = proj_create_operation_factory_context(m_ctxt, nullptr); + ASSERT_NE(ctxt, nullptr); + ContextKeeper keeper_ctxt(ctxt); + + // GDA94 / MGA zone 56 + auto source_crs = proj_create_from_database( + m_ctxt, "EPSG", "28356", PJ_CATEGORY_CRS, false, nullptr); + ASSERT_NE(source_crs, nullptr); + ObjectKeeper keeper_source_crs(source_crs); + + // GDA2020 / MGA zone 56 + auto target_crs = proj_create_from_database( + m_ctxt, "EPSG", "7856", PJ_CATEGORY_CRS, false, nullptr); + ASSERT_NE(target_crs, nullptr); + ObjectKeeper keeper_target_crs(target_crs); + + proj_operation_factory_context_set_spatial_criterion( + m_ctxt, ctxt, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION); + + proj_operation_factory_context_set_grid_availability_use( + m_ctxt, ctxt, PROJ_GRID_AVAILABILITY_IGNORED); + + auto res = proj_create_operations(m_ctxt, source_crs, target_crs, ctxt); + ASSERT_NE(res, nullptr); + ObjListKeeper keeper_res(res); + + ASSERT_GT(proj_list_get_count(res), 0); + + auto op = proj_list_get(m_ctxt, res, 0); + ASSERT_NE(op, nullptr); + ObjectKeeper keeper_op(op); + + ASSERT_EQ(proj_get_type(op), PJ_TYPE_CONCATENATED_OPERATION); + ASSERT_EQ(proj_concatoperation_get_step_count(m_ctxt, op), 3); + + EXPECT_EQ(proj_concatoperation_get_step(m_ctxt, op, -1), nullptr); + EXPECT_EQ(proj_concatoperation_get_step(m_ctxt, op, 3), nullptr); + + auto step = proj_concatoperation_get_step(m_ctxt, op, 1); + ASSERT_NE(step, nullptr); + ObjectKeeper keeper_step(step); + + const char* scope = proj_get_scope(step); + EXPECT_NE(scope, nullptr); + EXPECT_NE(std::string(scope), std::string()); + + const char* remarks = proj_get_remarks(step); + EXPECT_NE(remarks, nullptr); + EXPECT_NE(std::string(remarks), std::string()); + } +} + } // namespace diff --git a/test/unit/test_factory.cpp b/test/unit/test_factory.cpp index 34c5568c..298dbd4d 100644 --- a/test/unit/test_factory.cpp +++ b/test/unit/test_factory.cpp @@ -807,10 +807,14 @@ TEST(factory, AuthorityFactory_createCoordinateOperation_helmert_15_CF) { " ID[\"EPSG\",1047]],\n" " OPERATIONACCURACY[0.03],\n" " USAGE[\n" - " SCOPE[\"unknown\"],\n" + " SCOPE[\"Geodesy. RMS residuals 5mm north, 8mm east and 28mm " + "vertical, maximum residuals 10mm north, 13mm east and 51mm " + "vertical.\"],\n" " AREA[\"Australia - onshore and EEZ\"],\n" " BBOX[-47.2,109.23,-8.88,163.2]],\n" - " ID[\"EPSG\",6276]]"; + " ID[\"EPSG\",6276],\n" + " REMARK[\"Scale difference in ppb and scale difference rate in " + "ppb/yr where 1/billion = 1E-9 or nm/m.\"]]"; EXPECT_EQ( op->exportToWKT( @@ -911,10 +915,13 @@ TEST( "file\",\"RGNC1991_NEA74Noumea.gsb\"],\n" " OPERATIONACCURACY[0.05],\n" " USAGE[\n" - " SCOPE[\"unknown\"],\n" + " SCOPE[\"Accuracy 5-10cm.\"],\n" " AREA[\"New Caledonia - Grande Terre - Noumea\"],\n" " BBOX[-22.37,166.35,-22.19,166.54]],\n" - " ID[\"EPSG\",1295]]"; + " ID[\"EPSG\",1295],\n" + " REMARK[\"Emulation using NTv2 method of tfm NEA74 Noumea to " + "RGNC91-93 (3) (code 15943). Note reversal of sign of parameter values " + "in grid file.\"]]"; EXPECT_EQ( op->exportToWKT( WKTFormatter::create(WKTFormatter::Convention::WKT2_2018).get()), @@ -984,7 +991,7 @@ TEST(factory, AuthorityFactory_createCoordinateOperation_other_transformation) { " ID[\"EPSG\",8602]],\n" " OPERATIONACCURACY[0.0],\n" " USAGE[\n" - " SCOPE[\"unknown\"],\n" + " SCOPE[\"Change of prime meridian.\"],\n" " AREA[\"Europe - Czechoslovakia\"],\n" " BBOX[47.73,12.09,51.06,22.56]],\n" " ID[\"EPSG\",1884]]"; |
