Skip to content

Commit

Permalink
Add GIGS series 3211 tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdoug committed Apr 18, 2022
1 parent a86e516 commit 86162fd
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# File: GIGS_user_3211_VertTfm
# GIGS Test Procedure: 3211
# GIGS Test Dataset Version: 2.0
# EPSG Dataset Version: 10.019
# GIGS Test Dataset Issue Date: 2021-05-03
# Note: All transformations are reversible; reverse sign of parameter value to apply in opposite direction
#
# Fields:
# [0]: GIGS Transformation Code
# [1]: GIGS Source CRS Code (see GIGS Test Procedure 3210)
# [2]: GIGS Source CRS Name
# [3]: GIGS Target CRS Code (see GIGS Test Procedure 3210)
# [4]: GIGS Target CRS Name
# [5]: GIGS Transformation Version
# [6]: EPSG Transformation Method Name
# [7]: Parameter 1 Name
# [8]: Parameter 1 Value
# [9]: Parameter 1 Unit
# [10]: Parameter 2 Name
# [11]: Parameter 2 Value
# [12]: Parameter 2 Unit
# [13]: Parameter 3 Name
# [14]: Parameter 3 Value
# [15]: Parameter 3 Unit
# [16]: Parameter 4 Name
# [17]: Parameter 4 Value
# [18]: Parameter 4 Unit
# [19]: Parameter 5 Name
# [20]: Parameter 5 Value
# [21]: Parameter 5 Unit
# [22]: Equivalent EPSG Transformation Code
# [23]: Equivalent EPSG Transformation Name
# [24]: GIGS Remarks
#
# [0] # [1] # [2] # [3] # [4] # [5] # [6] # [7] # [8] # [9] # [10] # [11] # [12] # [13] # [14] # [15] # [16] # [17] # [18] # [19] # [20] # [21] # [22] # [23] # [24]
61501 64505 GIGS vertCRS V1 height 5714 MSL height 1 Vertical offset Vertical offset 0 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No direct EPSG equivalent
61502 64506 GIGS vertCRS V1 depth 5715 MSL depth 1 Vertical offset Vertical offset 0 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL No direct EPSG equivalent
65447 64505 GIGS vertCRS V1 height 64501 GIGS vertCRS U1 height 1 Vertical offset Vertical offset 0.4 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 5447 Baltic 1977 height to Black Sea height (1)
61503 64501 GIGS vertCRS U1 height 64505 GIGS vertCRS V1 height 2 Vertical Offset and Slope Ordinate 1 of evaluation point 52 degree Ordinate 2 of evaluation point 3 degree Vertical offset -0.486 metre Inclination in latitude -0.003 arc-second Inclination in longitude 0.006 arc-second No direct EPSG equivalent; extracted subset of 1503 NAD83 to NAD83(HARN) (30)
65440 64506 GIGS vertCRS V1 depth 64508 GIGS vertCRS W1 depth 1 Vertical offset Vertical offset -28 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 5440 Baltic 1977 depth to Caspian depth (1)
65441 64506 GIGS vertCRS V1 depth 64507 GIGS vertCRS W1 height 1 Vertical offset Vertical offset 28 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL EPSG equivalent deprecated but remains relevant; previous equivalent 5441 Baltic depth to Caspian height (1)
65400 64505 GIGS vertCRS V1 height 64508 GIGS vertCRS W1 depth 1 Vertical offset Vertical offset -28 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL EPSG equivalent deprecated but remains relevant; previous equivalent 5400 Baltic height to Caspian depth (1)
65438 64505 GIGS vertCRS V1 height 64507 GIGS vertCRS W1 height 1 Vertical offset Vertical offset 28 metre NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL 5438 Baltic 1977 height to Caspian height (1)
73 changes: 73 additions & 0 deletions tests/GIGS/GIGSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,79 @@ public function series3200VerticalCRSData(): Generator
}
}

/**
* @dataProvider series3200VerticalTransformationData
*/
public function testSeries3200VerticalTransformations(string $gigsCode, string $name, string $gigsSourceCRS, string $gigsTargetCRS, string $methodName, string $param1Name, string $param1Value, string $param1Unit, string $param2Name, string $param2Value, string $param2Unit, string $param3Name, string $param3Value, string $param3Unit, string $param4Name, string $param4Value, string $param4Unit, string $param5Name, string $param5Value, string $param5Unit, string $epsgOperationCode): void
{
if ($epsgOperationCode) {
$originalOperation = CoordinateOperations::getOperationData('urn:ogc:def:coordinateOperation:EPSG::' . $epsgOperationCode);
$originalParams = CoordinateOperations::getParamData('urn:ogc:def:coordinateOperation:EPSG::' . $epsgOperationCode);

$uoms = [
'NULL' => '',
'metre' => Length::EPSG_METRE,
];

$params = [
$this->makeParamName($param1Name) => [
'value' => $param1Value !== 'NULL' ? $param1Value : null,
'uom' => $uoms[$param1Unit],
'reverses' => true,
],
$this->makeParamName($param2Name) => [
'value' => $param2Value !== 'NULL' ? $param2Value : null,
'uom' => $uoms[$param2Unit],
'reverses' => true,
],
$this->makeParamName($param3Name) => [
'value' => $param3Value !== 'NULL' ? $param3Value : null,
'uom' => $uoms[$param3Unit],
'reverses' => true,
],
$this->makeParamName($param4Name) => [
'value' => $param4Value !== 'NULL' ? $param4Value : null,
'uom' => $uoms[$param4Unit],
'reverses' => true,
],
$this->makeParamName($param5Name) => [
'value' => $param5Value !== 'NULL' ? $param5Value : null,
'uom' => $uoms[$param5Unit],
'reverses' => true,
],
];

$params = array_filter($params, fn ($param) => $param['value'] !== null);
foreach ($params as $name => $param) {
$param[$name]['value'] = $param['uom'] === Angle::EPSG_SEXAGESIMAL_DMS ? $param['value'] : (float) $param['value'];
}

$method = match ($methodName) {
'Vertical offset' => CoordinateOperationMethods::EPSG_VERTICAL_OFFSET,
};

CoordinateOperations::registerCustomOperation('urn:ogc:def:coordinateOperation:GIGS::' . $gigsCode, $name, $method, [1262], $params);
CoordinateOperations::registerCustomTransformation('urn:ogc:def:coordinateOperation:GIGS::' . $gigsCode, $name, 'urn:ogc:def:crs:GIGS::' . $gigsSourceCRS, 'urn:ogc:def:crs:GIGS::' . $gigsTargetCRS, 0, true);

$gigsOperation = CoordinateOperations::getOperationData('urn:ogc:def:coordinateOperation:GIGS::' . $gigsCode);
$gigsParams = CoordinateOperations::getParamData('urn:ogc:def:coordinateOperation:GIGS::' . $gigsCode);

$this->assertEquals($originalOperation['method'], $gigsOperation['method']);
$this->assertEquals($originalParams, $gigsParams);
} else {
$this->expectNotToPerformAssertions();
}
}

public function series3200VerticalTransformationData(): Generator
{
[$header, $body] = $this->parseDataFile(__DIR__ . '/GIGS 3200 User-defined Geodetic Data Objects test data/ASCII/GIGS_user_3211_VertTfm.txt');

foreach ($body as $row) {
yield '#' . $row[0] => [$row[0], $row[5], $row[1], $row[3], $row[6], $row[7], $row[8], $row[9], $row[10], $row[11], $row[12], $row[13], $row[14], $row[15], $row[16], $row[17], $row[18], $row[19], $row[20], $row[21], $row[22], $row[23]];
}
}

/**
* @dataProvider series7000DeprecationData
*/
Expand Down

0 comments on commit 86162fd

Please sign in to comment.