aboutsummaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-08-26 00:18:36 +0200
committerEven Rouault <even.rouault@spatialys.com>2020-08-26 00:18:36 +0200
commit138555c2491a70428d3c8c82fdf9bb778ad0ae62 (patch)
tree3184c8908d7325ff2c69b59251810a00f6a18ae5 /test/unit
parent683d3097ff2cabd573a82757e8bef6d8f0447d37 (diff)
downloadPROJ-138555c2491a70428d3c8c82fdf9bb778ad0ae62.tar.gz
PROJ-138555c2491a70428d3c8c82fdf9bb778ad0ae62.zip
proj_create_vertical_crs_ex(): add a ACCURACY option to provide an explicit accuracy, or derive it from the grid name if it is known
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/test_c_api.cpp53
1 files changed, 52 insertions, 1 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index 947b993c..f6ba708f 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -4571,10 +4571,11 @@ TEST_F(CApi, proj_create_vertical_crs_ex) {
ObjectKeeper keeper_horiz_crs(horiz_crs);
ASSERT_NE(horiz_crs, nullptr);
+ const char *options[] = {"ACCURACY=123", nullptr};
auto vert_crs = proj_create_vertical_crs_ex(
m_ctxt, "myVertCRS (ftUS)", "myVertDatum", nullptr, nullptr,
"US survey foot", 0.304800609601219, "PROJ @foo.gtx", nullptr, nullptr,
- nullptr, nullptr);
+ nullptr, options);
ObjectKeeper keeper_vert_crs(vert_crs);
ASSERT_NE(vert_crs, nullptr);
@@ -4609,6 +4610,8 @@ TEST_F(CApi, proj_create_vertical_crs_ex) {
"+step +proj=vgridshift +grids=@foo.gtx +multiplier=1 "
"+step +proj=unitconvert +xy_in=rad +xy_out=deg "
"+step +proj=axisswap +order=2,1");
+
+ ASSERT_EQ(proj_coordoperation_get_accuracy(m_ctxt, P), 123.0);
}
// ---------------------------------------------------------------------------
@@ -4691,6 +4694,54 @@ TEST_F(CApi, proj_create_vertical_crs_ex_with_geog_crs) {
// ---------------------------------------------------------------------------
+TEST_F(CApi, proj_create_vertical_crs_ex_implied_accuracy) {
+
+ PJ *crsH = proj_create(m_ctxt, "EPSG:4283"); // GDA94
+ ASSERT_NE(crsH, nullptr);
+ ObjectKeeper keeper_crsH(crsH);
+ PJ *crsV = proj_create(m_ctxt, "EPSG:5711"); // AHD height
+ ASSERT_NE(crsV, nullptr);
+ ObjectKeeper keeper_crsV(crsV);
+ PJ *crsGeoid = proj_create(m_ctxt, "EPSG:4939"); // GDA94 3D
+ ASSERT_NE(crsGeoid, nullptr);
+ ObjectKeeper keeper_crsGeoid(crsGeoid);
+
+ PJ *vertDatum = proj_crs_get_datum(m_ctxt, crsV);
+ ObjectKeeper keeper_vertDatum(vertDatum);
+ const char *vertDatumName = proj_get_name(vertDatum);
+ const char *vertDatumAuthority = proj_get_id_auth_name(vertDatum, 0);
+ const char *vertDatumCode = proj_get_id_code(vertDatum, 0);
+ PJ *crsVGeoid = proj_create_vertical_crs_ex(
+ m_ctxt, "Vertical", vertDatumName, vertDatumAuthority, vertDatumCode,
+ "metre", 1.0, "PROJ au_ga_AUSGeoid09_V1.01.tif", nullptr, nullptr,
+ crsGeoid, nullptr);
+ ObjectKeeper keeper_crsVGeoid(crsVGeoid);
+ PJ *crsCompoundGeoid = proj_create_compound_crs(
+ m_ctxt, "Compound with geoid", crsH, crsVGeoid);
+ ObjectKeeper keeper_crsCompoundGeoid(crsCompoundGeoid);
+
+ PJ_OPERATION_FACTORY_CONTEXT *ctxt =
+ proj_create_operation_factory_context(m_ctxt, nullptr);
+ ASSERT_NE(ctxt, nullptr);
+ ContextKeeper keeper_ctxt(ctxt);
+ proj_operation_factory_context_set_grid_availability_use(
+ m_ctxt, ctxt, PROJ_GRID_AVAILABILITY_IGNORED);
+ proj_operation_factory_context_set_spatial_criterion(
+ m_ctxt, ctxt, PROJ_SPATIAL_CRITERION_PARTIAL_INTERSECTION);
+ PJ_OBJ_LIST *operations =
+ proj_create_operations(m_ctxt, crsCompoundGeoid, crsGeoid, ctxt);
+ ASSERT_NE(operations, nullptr);
+ ObjListKeeper keeper_operations(operations);
+ EXPECT_GE(proj_list_get_count(operations), 1);
+ PJ *transform = proj_list_get(m_ctxt, operations, 0);
+ ObjectKeeper keeper_transform(transform);
+
+ // This is the accuracy of operations EPSG:5656 / 5657
+ ASSERT_EQ(proj_coordoperation_get_accuracy(m_ctxt, transform), 0.03);
+}
+
+// ---------------------------------------------------------------------------
+
TEST_F(CApi, proj_create_derived_geographic_crs) {
PJ *crs_4326 = proj_create(m_ctxt, "EPSG:4326");