Skip to content

Commit

Permalink
Merge 0b5fb12 into d1f432e
Browse files Browse the repository at this point in the history
  • Loading branch information
rouault committed Dec 11, 2019
2 parents d1f432e + 0b5fb12 commit 1c4a0eb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/iso19111/coordinateoperation.cpp
Expand Up @@ -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
Expand Down
27 changes: 27 additions & 0 deletions test/unit/test_operation.cpp
Expand Up @@ -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");
Expand Down

0 comments on commit 1c4a0eb

Please sign in to comment.