aboutsummaryrefslogtreecommitdiff
path: root/test/unit/test_c_api.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-03-19 23:06:13 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-03-19 23:17:59 +0100
commit5aa3d9fce2e29f7a20d68708d06c55685efe3d5a (patch)
tree88b2a28d807bd5c4942d19d5a98a8a083de48cd8 /test/unit/test_c_api.cpp
parent0c5802e0f840cf289dffa02571e414b276bb7d62 (diff)
downloadPROJ-5aa3d9fce2e29f7a20d68708d06c55685efe3d5a.tar.gz
PROJ-5aa3d9fce2e29f7a20d68708d06c55685efe3d5a.zip
proj_get_suggested_operation(): fix when there are only operations without area of use
Diffstat (limited to 'test/unit/test_c_api.cpp')
-rw-r--r--test/unit/test_c_api.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/test/unit/test_c_api.cpp b/test/unit/test_c_api.cpp
index c984e84e..610d7cde 100644
--- a/test/unit/test_c_api.cpp
+++ b/test/unit/test_c_api.cpp
@@ -1382,6 +1382,43 @@ TEST_F(CApi, proj_create_operations) {
// ---------------------------------------------------------------------------
+TEST_F(CApi, proj_get_suggested_operation_with_operations_without_area_of_use) {
+ auto ctxt = proj_create_operation_factory_context(m_ctxt, nullptr);
+ ASSERT_NE(ctxt, nullptr);
+ ContextKeeper keeper_ctxt(ctxt);
+
+ // NAD83(2011) geocentric
+ auto source_crs = proj_create_from_database(
+ m_ctxt, "EPSG", "6317", PJ_CATEGORY_CRS, false, nullptr);
+ ASSERT_NE(source_crs, nullptr);
+ ObjectKeeper keeper_source_crs(source_crs);
+
+ // NAD83(2011) 2D
+ auto target_crs = proj_create_from_database(
+ m_ctxt, "EPSG", "6318", 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);
+
+ PJ_COORD coord;
+ coord.xyz.x = -463930;
+ coord.xyz.y = -4414006;
+ coord.xyz.z = 4562247;
+ int idx = proj_get_suggested_operation(m_ctxt, res, PJ_FWD, coord);
+ EXPECT_GE(idx, 0);
+}
+
+// ---------------------------------------------------------------------------
+
TEST_F(CApi, proj_create_operations_discard_superseded) {
auto ctxt = proj_create_operation_factory_context(m_ctxt, nullptr);
ASSERT_NE(ctxt, nullptr);