aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-12-19 23:14:07 +0100
committerGitHub <noreply@github.com>2019-12-19 23:14:07 +0100
commit444bc1f661b6fefaeceebd775fbcf147187bc13c (patch)
tree819550c4b75931e53fe4f7649e64965c5bf79c0f
parent13dd313795ec37a810923c97327030b0f352d904 (diff)
parent1433adcc673928a092c16f6555a0fcd701fdbc26 (diff)
downloadPROJ-444bc1f661b6fefaeceebd775fbcf147187bc13c.tar.gz
PROJ-444bc1f661b6fefaeceebd775fbcf147187bc13c.zip
Merge pull request #1770 from ccrook/nzlvd_support
Adding support for NZLVD vertical height transformation
-rw-r--r--src/iso19111/coordinateoperation.cpp16
-rw-r--r--src/proj_constants.h3
-rw-r--r--test/unit/test_operation.cpp8
3 files changed, 26 insertions, 1 deletions
diff --git a/src/iso19111/coordinateoperation.cpp b/src/iso19111/coordinateoperation.cpp
index 62d72e65..28f8b41c 100644
--- a/src/iso19111/coordinateoperation.cpp
+++ b/src/iso19111/coordinateoperation.cpp
@@ -8767,7 +8767,8 @@ TransformationNNPtr Transformation::substitutePROJAlternativeGridNames(
}
}
- if (methodEPSGCode == EPSG_CODE_METHOD_VERTCON) {
+ if (methodEPSGCode == EPSG_CODE_METHOD_VERTCON ||
+ methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_NZLVD ) {
auto fileParameter =
parameterValue(EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE,
EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE);
@@ -9441,6 +9442,19 @@ void Transformation::_exportToPROJString(
}
}
+ if (methodEPSGCode == EPSG_CODE_METHOD_VERTICALGRID_NZLVD) {
+ auto fileParameter =
+ parameterValue(EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE,
+ EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE);
+ if (fileParameter &&
+ fileParameter->type() == ParameterValue::Type::FILENAME) {
+ formatter->addStep("vgridshift");
+ formatter->addParam("grids", fileParameter->valueFile());
+ formatter->addParam("multiplier", 1.0);
+ return;
+ }
+ }
+
if (isLongitudeRotation()) {
double offsetDeg =
parameterValueNumeric(EPSG_CODE_PARAMETER_LONGITUDE_OFFSET,
diff --git a/src/proj_constants.h b/src/proj_constants.h
index 5c642862..21cd87fb 100644
--- a/src/proj_constants.h
+++ b/src/proj_constants.h
@@ -513,6 +513,9 @@
#define EPSG_CODE_METHOD_VERTCON 9658
#define EPSG_NAME_METHOD_VERTCON "VERTCON"
+#define EPSG_CODE_METHOD_VERTICALGRID_NZLVD 1071
+#define EPSG_NAME_METHOD_VERTICALGRID_NZLVD "Vertical Offset by Grid Interpolation (NZLVD)"
+
#define EPSG_NAME_PARAMETER_VERTICAL_OFFSET_FILE "Vertical offset file"
#define EPSG_CODE_PARAMETER_VERTICAL_OFFSET_FILE 8732
diff --git a/test/unit/test_operation.cpp b/test/unit/test_operation.cpp
index d503034c..15724c48 100644
--- a/test/unit/test_operation.cpp
+++ b/test/unit/test_operation.cpp
@@ -6537,6 +6537,14 @@ TEST(operation, transformation_VERTCON_to_PROJ_string) {
PROJStringFormatter::create().get()),
"+proj=vgridshift +grids=bla.gtx +multiplier=0.001");
}
+// ---------------------------------------------------------------------------
+
+TEST(operation, transformation_NZLVD_to_PROJ_string) {
+ auto factory = AuthorityFactory::create(DatabaseContext::create(), "EPSG");
+ auto op = factory->createCoordinateOperation("7860", false);
+ EXPECT_EQ(op->exportToPROJString(PROJStringFormatter::create().get()),
+ "+proj=vgridshift +grids=auckland-1946-to-nzvd2016-conversion.csv +multiplier=1");
+}
// ---------------------------------------------------------------------------