aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/sql/grid_alternatives.sql30
-rw-r--r--src/iso19111/coordinateoperation.cpp43
-rwxr-xr-xtest/cli/testprojinfo8
-rw-r--r--test/cli/testprojinfo_out.dist20
4 files changed, 95 insertions, 6 deletions
diff --git a/data/sql/grid_alternatives.sql b/data/sql/grid_alternatives.sql
index 647f14e6..d240a3d8 100644
--- a/data/sql/grid_alternatives.sql
+++ b/data/sql/grid_alternatives.sql
@@ -1046,6 +1046,36 @@ INSERT INTO grid_alternatives(original_grid_name,
'proj-datumgrid-oceania',
NULL, NULL, NULL, NULL);
+INSERT INTO grid_alternatives(original_grid_name,
+ proj_grid_name,
+ proj_grid_format,
+ proj_method,
+ inverse_direction,
+ package_name,
+ url, direct_download, open_license, directory)
+ VALUES ('AUSGeoid09_GDA94_V1.01_DOV_windows.gsb', -- source file contains undulation in first band, and deflection in 2nd and 3d band
+ 'AUSGeoid09_V1.01.gtx',
+ 'GTX',
+ 'vgridshift',
+ 1,
+ 'proj-datumgrid-oceania',
+ NULL, NULL, NULL, NULL);
+
+INSERT INTO grid_alternatives(original_grid_name,
+ proj_grid_name,
+ proj_grid_format,
+ proj_method,
+ inverse_direction,
+ package_name,
+ url, direct_download, open_license, directory)
+ VALUES ('AUSGeoid2020_windows_binary.gsb', -- source file contains undulation in first band, and deflection in 2nd and 3d band
+ 'AUSGeoid2020_20180201.gtx',
+ 'GTX',
+ 'vgridshift',
+ 1,
+ 'proj-datumgrid-oceania',
+ NULL, NULL, NULL, NULL);
+
-- Netherlands / RDNAP (non-free grids)
INSERT INTO grid_alternatives(original_grid_name,
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index c295aff2..6120c768 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -12923,9 +12923,40 @@ bool CoordinateOperationFactory::Private::createOperationsFromDatabase(
bool sameGeodeticDatum = false;
if (vertSrc || vertDst) {
- createOperationsFromDatabaseWithVertCRS(sourceCRS, targetCRS, context,
- geogSrc, geogDst, vertSrc,
- vertDst, res);
+ if (res.empty()) {
+ if (geogSrc &&
+ geogSrc->coordinateSystem()->axisList().size() == 2 &&
+ vertDst) {
+ auto dbContext =
+ context.context->getAuthorityFactory()->databaseContext();
+ auto resTmp = findOpsInRegistryDirect(
+ sourceCRS->promoteTo3D(std::string(), dbContext), targetCRS,
+ context, resFindDirectNonEmptyBeforeFiltering);
+ for (auto &op : resTmp) {
+ auto newOp = op->shallowClone();
+ setCRSs(newOp.get(), sourceCRS, targetCRS);
+ res.emplace_back(newOp);
+ }
+ } else if (geogDst &&
+ geogDst->coordinateSystem()->axisList().size() == 2 &&
+ vertSrc) {
+ auto dbContext =
+ context.context->getAuthorityFactory()->databaseContext();
+ auto resTmp = findOpsInRegistryDirect(
+ sourceCRS, targetCRS->promoteTo3D(std::string(), dbContext),
+ context, resFindDirectNonEmptyBeforeFiltering);
+ for (auto &op : resTmp) {
+ auto newOp = op->shallowClone();
+ setCRSs(newOp.get(), sourceCRS, targetCRS);
+ res.emplace_back(newOp);
+ }
+ }
+ }
+ if (res.empty()) {
+ createOperationsFromDatabaseWithVertCRS(sourceCRS, targetCRS,
+ context, geogSrc, geogDst,
+ vertSrc, vertDst, res);
+ }
} else if (geodSrc && geodDst) {
const auto &srcDatum = geodSrc->datum();
@@ -13406,7 +13437,7 @@ void CoordinateOperationFactory::Private::createOperationsGeodToGeod(
util::IComparable::Criterion::EQUIVALENT)) {
res.emplace_back(
Conversion::createGeographicGeocentric(sourceCRS, targetCRS));
- } else if (isSrcGeocentric) {
+ } else if (isSrcGeocentric && geogDst) {
std::string interm_crs_name(geogDst->nameStr());
interm_crs_name += " (geocentric)";
auto interm_crs =
@@ -13539,7 +13570,7 @@ void CoordinateOperationFactory::Private::createOperationsBoundToGeog(
}
}
// If the datum are equivalent, this is also fine
- } else if (geogCRSOfBaseOfBoundSrc && hubSrcGeog->datum() &&
+ } else if (geogCRSOfBaseOfBoundSrc && hubSrcGeog && hubSrcGeog->datum() &&
geogDst->datum() &&
hubSrcGeog->datum()->_isEquivalentTo(
geogDst->datum().get(),
@@ -13568,7 +13599,7 @@ void CoordinateOperationFactory::Private::createOperationsBoundToGeog(
// Case of "+proj=latlong +ellps=clrk66
// +nadgrids=ntv1_can.dat,conus"
// to "+proj=latlong +datum=NAD83"
- } else if (geogCRSOfBaseOfBoundSrc && hubSrcGeog->datum() &&
+ } else if (geogCRSOfBaseOfBoundSrc && hubSrcGeog && hubSrcGeog->datum() &&
geogDst->datum() &&
geogCRSOfBaseOfBoundSrc->ellipsoid()->_isEquivalentTo(
datum::Ellipsoid::CLARKE_1866.get(),
diff --git a/test/cli/testprojinfo b/test/cli/testprojinfo
index 9d0ce52d..4ce5e90c 100755
--- a/test/cli/testprojinfo
+++ b/test/cli/testprojinfo
@@ -147,6 +147,14 @@ echo 'Testing -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check non
$EXE -s EPSG:31467 -t ETRS89 --spatial-test intersects --grid-check none --bbox 8,48,9,49 --summary >>${OUT} 2>&1
echo "" >>${OUT}
+echo 'Testing -s "GDA94" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects' >> ${OUT}
+$EXE -s "GDA94" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects >>${OUT} 2>&1
+echo "" >>${OUT}
+
+echo 'Testing -s "GDA2020" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects' >> ${OUT}
+$EXE -s "GDA2020" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects >>${OUT} 2>&1
+echo "" >>${OUT}
+
# do 'diff' with distribution results
echo "diff ${OUT} with testprojinfo_out.dist"
diff -u ${OUT} ${TEST_CLI_DIR}/testprojinfo_out.dist
diff --git a/test/cli/testprojinfo_out.dist b/test/cli/testprojinfo_out.dist
index 8b17c0e7..25b29a79 100644
--- a/test/cli/testprojinfo_out.dist
+++ b/test/cli/testprojinfo_out.dist
@@ -1078,3 +1078,23 @@ unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (8), 0.9 m,
unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (3), 1 m, Germany - West Germany S
unknown id, Inverse of 3-degree Gauss-Kruger zone 3 + DHDN to ETRS89 (2), 3 m, Germany - West Germany all states
+Testing -s "GDA94" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects
+Candidate operations found: 1
+-------------------------------------
+Operation n°1:
+
+DERIVED_FROM(EPSG):5656, GDA94 to AHD height (49), 0.03 m, Australia - mainland
+
+PROJ string:
++proj=pipeline +step +inv +proj=vgridshift +grids=AUSGeoid09_V1.01.gtx +multiplier=1
+
+Testing -s "GDA2020" -t "AHD height" --grid-check none -o PROJ --spatial-test intersects
+Candidate operations found: 1
+-------------------------------------
+Operation n°1:
+
+DERIVED_FROM(EPSG):8451, GDA2020 to AHD height (1), 0.03 m, Australia Christmas and Cocos - onshore
+
+PROJ string:
++proj=pipeline +step +inv +proj=vgridshift +grids=AUSGeoid2020_20180201.gtx +multiplier=1
+