Esempio n. 1
0
 /**
  * Convert this LatLng object into an OSGB grid reference. Note that this
  * function does not take into account the bounds of the OSGB grid -
  * beyond the bounds of the OSGB grid, the resulting OSRef object has no
  * meaning
  *
  * Reference values for transformation are taken from OS document
  * "A Guide to Coordinate Systems in Great Britain"
  *
  * @return OSRef
  */
 public function toOSRef()
 {
     if ($this->refEll != RefEll::Airy1830()) {
         trigger_error('Current co-ordinates are in a non-OSGB datum', E_USER_WARNING);
     }
     $OSGB = new OSRef(0, 0);
     //dummy to get reference data
     $scale = $OSGB->getScaleFactor();
     $N0 = $OSGB->getOriginNorthing();
     $E0 = $OSGB->getOriginEasting();
     $phi0 = $OSGB->getOriginLatitude();
     $lambda0 = $OSGB->getOriginLongitude();
     $coords = $this->toTransverseMercatorEastingNorthing($scale, $E0, $N0, $phi0, $lambda0);
     return new OSRef($coords['E'], $coords['N']);
 }
Esempio n. 2
0
 /**
  * @expectedException \PHPUnit_Framework_Error_Warning
  */
 public function testDistanceDifferentEllipsoids()
 {
     $work = new LatLng(51.54105, -0.12319, RefEll::Airy1830());
     $charingCross = new LatLng(51.507977, -0.124588, RefEll::WGS84());
     $expected = 3678.49665;
     self::assertEquals($expected, $work->distance($charingCross));
 }
Esempio n. 3
0
 public function getReferenceEllipsoid()
 {
     return RefEll::Airy1830();
 }