Skip to content

Commit

Permalink
Correct rotation params when doing Helmert from Airy Modified <-> WGS…
Browse files Browse the repository at this point in the history
…84. Fixes #25
  • Loading branch information
dvdoug committed Apr 16, 2020
1 parent fd65665 commit 64942c1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/LatLng.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,9 +193,9 @@ public function toIreland1975(): self
$ty = 130.596;
$tz = -564.557;
$s = -0.00000815;
$rx = deg2rad(-1.042 / 3600);
$ry = deg2rad(-0.214 / 3600);
$rz = deg2rad(-0.631 / 3600);
$rx = deg2rad(1.042 / 3600);
$ry = deg2rad(0.214 / 3600);
$rz = deg2rad(0.631 / 3600);

return $asWGS84->transformDatum(RefEll::airyModified(), $tx, $ty, $tz, $s, $rx, $ry, $rz);
}
Expand Down Expand Up @@ -229,9 +229,9 @@ public function toWGS84(): self
$ty = -130.596;
$tz = 564.557;
$s = 0.00000815;
$rx = deg2rad(1.042 / 3600);
$ry = deg2rad(0.214 / 3600);
$rz = deg2rad(0.631 / 3600);
$rx = deg2rad(-1.042 / 3600);
$ry = deg2rad(-0.214 / 3600);
$rz = deg2rad(-0.631 / 3600);
break;

case RefEll::clarke1866(): // assumes NAD27, values from Wikipedia
Expand Down
5 changes: 5 additions & 0 deletions tests/IrishGridRefTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ public function testLatLngOSIWorkedExample(): void
$expected = '(53.48505, -6.91966)';

self::assertEquals($expected, $LatLng->__toString());

$LatLngWGS84 = $LatLng->toWGS84();
$expected = '(53.48527, -6.92054)';

self::assertEquals($expected, $LatLngWGS84->__toString());
}

public function testToSixFigureRef(): void
Expand Down
4 changes: 2 additions & 2 deletions tests/LatLngTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ public function testWGS84ToIreland75(): void
$LatLng = new LatLng(12.3, 12.3, 0, RefEll::wgs84());
$asIreland1975 = $LatLng->toIreland1975();

$expected = '(12.29557, 12.30201)';
$expected = '(12.29558, 12.30223)';
self::assertEquals($expected, $asIreland1975->__toString());
}

public function testIreland75ToWGS84(): void
{
$LatLng = new LatLng(12.29557, 12.30201, 0, RefEll::airyModified());
$LatLng = new LatLng(12.29558, 12.30223, 0, RefEll::airyModified());
$asWGS84 = $LatLng->toWGS84();

$expected = '(12.3, 12.3)';
Expand Down

0 comments on commit 64942c1

Please sign in to comment.