예제 #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()
 {
     $this->toOSGB36();
     $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(round($coords['E']), round($coords['N']), $this->h);
 }
예제 #2
0
파일: LatLng.php 프로젝트: caffme/PHPCoord
 /**
  * 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']);
 }