Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coord. operation factory: count identified concatenated operations as a single step #3673

Merged
merged 1 commit into from
Mar 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/iso19111/operation/coordinateoperationfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,12 @@ struct FilterResults {
const auto curAccuracy = getAccuracy(op);
bool dummy = false;
const auto curExtent = getExtent(op, true, dummy);
const auto curStepCount = getTransformationStepCount(op);
// If a concatenated operation has an identifier, consider it as
// a single step (to be opposed to synthetized concatenated
// operations). Helps for example to get EPSG:8537,
// "Egypt 1907 to WGS 84 (2)"
const auto curStepCount =
op->identifiers().empty() ? getTransformationStepCount(op) : 1;

if (first) {
resTemp.emplace_back(op);
Expand Down
20 changes: 19 additions & 1 deletion test/unit/test_operationfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ TEST(operation, geogCRS_to_geogCRS_context_concatenated_operation) {
authFactory->createCoordinateReferenceSystem("4807"), // NTF(Paris)
authFactory->createCoordinateReferenceSystem("4171"), // RGF93
ctxt);
ASSERT_EQ(list.size(), 4U);
ASSERT_EQ(list.size(), 2U);

EXPECT_EQ(list[0]->nameStr(), "NTF (Paris) to RGF93 v1 (1)");
EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
Expand Down Expand Up @@ -1092,6 +1092,24 @@ TEST(operation, geogCRS_to_geogCRS_context_concatenated_operation) {

// ---------------------------------------------------------------------------

TEST(operation,
geogCRS_to_geogCRS_context_concatenated_operation_Egypt1907_to_WGS84) {
auto authFactory =
AuthorityFactory::create(DatabaseContext::create(), "EPSG");
auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
auto list = CoordinateOperationFactory::create()->createOperations(
authFactory->createCoordinateReferenceSystem("4229"), // Egypt 1907
authFactory->createCoordinateReferenceSystem("4326"), // WGS84
ctxt);
ASSERT_EQ(list.size(), 3U);
// Concatenated operation
EXPECT_EQ(list[1]->nameStr(), "Egypt 1907 to WGS 84 (2)");
ASSERT_EQ(list[1]->coordinateOperationAccuracies().size(), 1U);
EXPECT_EQ(list[1]->coordinateOperationAccuracies()[0]->value(), "6.0");
}

// ---------------------------------------------------------------------------

TEST(operation, geogCRS_to_geogCRS_context_ED50_to_WGS72_no_NTF_intermediate) {
auto authFactory =
AuthorityFactory::create(DatabaseContext::create(), "EPSG");
Expand Down