Пример #1
0
 public function testHelmertOSWorkedExample()
 {
     $tx = -446.448;
     $ty = 125.157;
     $tz = -542.0599999999999;
     $s = 2.04894E-5;
     $rx = -0.1502;
     $ry = -0.247;
     $rz = -0.8421;
     $c = new Cartesian(3909833.018, -147097.138, 5020322.478, RefEll::wgs84());
     $c->transformDatum(RefEll::airy1830(), $tx, $ty, $tz, $s, $rx, $ry, $rz);
     self::assertEquals(3909460.068, round($c->getX(), 3));
     self::assertEquals(-146987.302, round($c->getY(), 3));
     self::assertEquals(5019888.07, round($c->getZ(), 3));
 }
Пример #2
0
 /**
  * Convert this LatLng object from WGS84 datum to Ireland 1975 datum.
  * Reference values for transformation are taken from OSI document
  * "Making maps compatible with GPS"
  * @return void
  */
 public function toWGS84()
 {
     switch ($this->refEll) {
         case RefEll::wgs84():
             return;
             //do nothing
         //do nothing
         case RefEll::airy1830():
             // values from OSGB document "A Guide to Coordinate Systems in Great Britain"
             $tx = 446.448;
             $ty = -125.157;
             $tz = 542.0599999999999;
             $s = -2.04894E-5;
             $rx = deg2rad(0.1502 / 3600);
             $ry = deg2rad(0.247 / 3600);
             $rz = deg2rad(0.8421 / 3600);
             break;
         case RefEll::airyModified():
             // values from OSI document "Making maps compatible with GPS"
             $tx = 482.53;
             $ty = -130.596;
             $tz = 564.557;
             $s = 8.15E-6;
             $rx = deg2rad(1.042 / 3600);
             $ry = deg2rad(0.214 / 3600);
             $rz = deg2rad(0.631 / 3600);
             break;
         case RefEll::clarke1866():
             // assumes NAD27, values from Wikipedia
             $tx = -8;
             $ty = 160;
             $tz = 176;
             $s = 0;
             $rx = deg2rad(0);
             $ry = deg2rad(0);
             $rz = deg2rad(0);
             break;
         case RefEll::international1924():
             // assumes ED50, values from http://www.globalmapper.com/helpv9/datum_list.htm
             $tx = -87;
             $ty = -98;
             $tz = -121;
             $s = 0;
             $rx = deg2rad(0);
             $ry = deg2rad(0);
             $rz = deg2rad(0);
             break;
         case RefEll::bessel1841():
             // assumes Germany, values from Wikipedia
             $tx = 582;
             $ty = -105;
             $tz = -414;
             $s = 8.3E-6;
             $rx = deg2rad(1.04);
             $ry = deg2rad(0.35);
             $rz = deg2rad(-3.08);
             break;
         default:
             throw new \RuntimeException('Transform paramaters not known for this ellipsoid');
     }
     $this->transformDatum(RefEll::wgs84(), $tx, $ty, $tz, $s, $rx, $ry, $rz);
 }
Пример #3
0
 /**
  * @expectedException \RuntimeException
  */
 public function testDistanceDifferentEllipsoids()
 {
     $work = new LatLng(51.54105, -0.12319, 0, RefEll::airy1830());
     $charingCross = new LatLng(51.507977, -0.124588, 0, RefEll::wgs84());
     $expected = 3678.49665;
     self::assertEquals($expected, $work->distance($charingCross));
 }
Пример #4
0
 /**
  * Create a new object representing a OSGB reference.
  *
  * @param int $x
  * @param int $y
  * @param int $z
  */
 public function __construct($x, $y, $z = 0)
 {
     parent::__construct($x, $y, $z, RefEll::airy1830());
 }