Ejemplo n.º 1
0
 public function testDmsToDecimal()
 {
     $decimal = Location::dmsToDecimal(117, 29, 50.5);
     $this->assertEquals(117.49736, round($decimal, 5));
     $decimal2 = Location::dmsToDecimal(1, 2, 3.45, 'W');
     $this->assertEquals(-1.0342916666667, $decimal2);
 }
Ejemplo n.º 2
0
 /**
  * Create a new point from Degrees, minutes and seconds
  *
  * @param array $lat Latitude in the order of degress, minutes, seconds[, direction]
  * @param array $lon Longitude in the order of degress, minutes, seconds[, direction]
  *
  * @return Point
  */
 public static function fromDms(array $lat, array $lon)
 {
     $decLat = Location::dmsToDecimal($lat[0], $lat[1], $lat[2], isset($lat[3]) ? $lat[3] : null);
     $decLon = Location::dmsToDecimal($lon[0], $lon[1], $lon[2], isset($lon[3]) ? $lon[3] : null);
     return new self($decLat, $decLon);
 }