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

createOperations(): do Helmert transformation in 2D when one of source or target CRS is compound #4337

Merged
merged 1 commit into from
Dec 7, 2024
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
6 changes: 5 additions & 1 deletion src/iso19111/operation/singleoperation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3545,7 +3545,11 @@ bool SingleOperation::exportToPROJStringGeneric(
((sourceCRSGeog &&
sourceCRSGeog->coordinateSystem()->axisList().size() == 2) ||
(targetCRSGeog &&
targetCRSGeog->coordinateSystem()->axisList().size() == 2));
targetCRSGeog->coordinateSystem()->axisList().size() == 2)) ||
(!sourceCRSGeog &&
dynamic_cast<const crs::CompoundCRS *>(l_sourceCRS.get())) ||
(!targetCRSGeog &&
dynamic_cast<const crs::CompoundCRS *>(l_targetCRS.get()));

if (l_sourceCRS) {
setupPROJGeodeticSourceCRS(formatter, NN_NO_CHECK(l_sourceCRS),
Expand Down
38 changes: 38 additions & 0 deletions test/unit/test_operationfactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5954,6 +5954,44 @@ TEST(operation,

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

TEST(operation, compoundCRS_to_compoundCRS_context_helmert) {
auto dbContext = DatabaseContext::create();
auto authFactory = AuthorityFactory::create(dbContext, "EPSG");
auto ctxt = CoordinateOperationContext::create(authFactory, nullptr, 0.0);
ctxt->setGridAvailabilityUse(
CoordinateOperationContext::GridAvailabilityUse::
IGNORE_GRID_AVAILABILITY);
ctxt->setSpatialCriterion(
CoordinateOperationContext::SpatialCriterion::PARTIAL_INTERSECTION);
// GDA94 + AHD height
auto objSrc = createFromUserInput("EPSG:9464", dbContext);
auto srcCrs = nn_dynamic_pointer_cast<CompoundCRS>(objSrc);
ASSERT_TRUE(srcCrs != nullptr);
// GDA2020 + AHD height
auto objDest = createFromUserInput("EPSG:9463", dbContext);
auto destCrs = nn_dynamic_pointer_cast<CompoundCRS>(objDest);
ASSERT_TRUE(destCrs != nullptr);
auto list = CoordinateOperationFactory::create()->createOperations(
NN_NO_CHECK(srcCrs), NN_NO_CHECK(destCrs), ctxt);
ASSERT_GE(list.size(), 1U);
// Check presence of push/pop v_3
EXPECT_EQ(list[0]->exportToPROJString(PROJStringFormatter::create().get()),
"+proj=pipeline "
"+step +proj=axisswap +order=2,1 "
"+step +proj=unitconvert +xy_in=deg +xy_out=rad "
"+step +proj=push +v_3 "
"+step +proj=cart +ellps=GRS80 "
"+step +proj=helmert +x=0.06155 +y=-0.01087 +z=-0.04019 "
"+rx=-0.0394924 +ry=-0.0327221 +rz=-0.0328979 +s=-0.009994 "
"+convention=coordinate_frame "
"+step +inv +proj=cart +ellps=GRS80 "
"+step +proj=pop +v_3 "
"+step +proj=unitconvert +xy_in=rad +xy_out=deg "
"+step +proj=axisswap +order=2,1");
}

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

TEST(
operation,
compoundCRS_to_compoundCRS_concatenated_operation_with_two_vert_transformation) {
Expand Down
Loading