diff options
| author | Chris Crook <ccrook@linz.govt.nz> | 2019-12-04 09:48:08 +1300 |
|---|---|---|
| committer | Chris Crook <ccrook@linz.govt.nz> | 2019-12-20 10:23:44 +1300 |
| commit | 1433adcc673928a092c16f6555a0fcd701fdbc26 (patch) | |
| tree | 819550c4b75931e53fe4f7649e64965c5bf79c0f | |
| parent | 13dd313795ec37a810923c97327030b0f352d904 (diff) | |
| download | PROJ-1433adcc673928a092c16f6555a0fcd701fdbc26.tar.gz PROJ-1433adcc673928a092c16f6555a0fcd701fdbc26.zip | |
Adding support for NZLVD vertical height transformation
| -rw-r--r-- | src/iso19111/coordinateoperation.cpp | 16 | ||||
| -rw-r--r-- | src/proj_constants.h | 3 | ||||
| -rw-r--r-- | test/unit/test_operation.cpp | 8 |
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"); +} // --------------------------------------------------------------------------- |
