aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-12-11 22:28:40 +0100
committerGitHub <noreply@github.com>2019-12-11 22:28:40 +0100
commit28d61f5ee6dfaf7b2f68dc922c4ff7202427a5d7 (patch)
treea3195f9b02a4f7b8d4497c4069699ca02318cfbf
parentd1f432ea6e933cf06ce3ecaedf0e978ed30ec6f6 (diff)
parent0b5fb1239f93e93971e28c95df6b039156c65ffb (diff)
downloadPROJ-28d61f5ee6dfaf7b2f68dc922c4ff7202427a5d7.tar.gz
PROJ-28d61f5ee6dfaf7b2f68dc922c4ff7202427a5d7.zip
Merge pull request #1788 from rouault/tune_too_agressive_result_removal_indian_1975_to_4326
createOperations(): make filtering out of 'uninteresting' operations less aggressive (refs #1787)
-rw-r--r--src/iso19111/coordinateoperation.cpp10
-rw-r--r--test/unit/test_operation.cpp27
2 files changed, 36 insertions, 1 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 791bdcb0..0469cae1 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -11301,9 +11301,17 @@ struct FilterResults {
setOfSetOfGrids.end()) {
continue;
}
+
+ const bool sameNameOrEmptyName =
+ ((!curExtent && !lastExtent) ||
+ (curExtent && lastExtent &&
+ !curExtent->description()->empty() &&
+ *(curExtent->description()) ==
+ *(lastExtent->description())));
+
// If we have already found a operation without grids for
// that extent, no need to add any lower accuracy operation
- if (!lastHasGrids) {
+ if (!lastHasGrids && sameNameOrEmptyName) {
continue;
}
// If we had only operations involving grids, but one
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index 9cde8822..9cf03555 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -4628,6 +4628,33 @@ TEST(operation, geogCRS_to_geogCRS_context_WGS84_G1674_to_WGS84_G1762) {
// ---------------------------------------------------------------------------
+TEST(operation, geogCRS_to_geogCRS_context_EPSG_4240_Indian1975_to_EPSG_4326) {
+ auto authFactory =
+ AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0);
+ ctxt->setSpatialCriterion(
+ CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION);
+
+ auto list = CoordinateOperationFactory::create()->createOperations(
+ authFactory->createCoordinateReferenceSystem("4240"), // Indian 1975
+ authFactory->createCoordinateReferenceSystem("4326"), ctxt);
+ ASSERT_EQ(list.size(), 3U);
+
+ // Indian 1975 to WGS 84 (4), 3.0 m, Thailand - onshore
+ EXPECT_EQ(list[0]->getEPSGCode(), 1812);
+
+ // The following is the one we want to see. It has a lesser accuracy than
+ // the above one and the same bbox, but the name of its area of use is
+ // slightly different
+ // Indian 1975 to WGS 84 (2), 5.0 m, Thailand - onshore and Gulf of Thailand
+ EXPECT_EQ(list[1]->getEPSGCode(), 1304);
+
+ // Indian 1975 to WGS 84 (3), 1.0 m, Thailand - Bongkot field
+ EXPECT_EQ(list[2]->getEPSGCode(), 1537);
+}
+
+// ---------------------------------------------------------------------------
+
TEST(operation, vertCRS_to_geogCRS_context) {
auto authFactory =
AuthorityFactory::create(DatabaseContext::create(), "EPSG");