/** * Pretty-print a full coordinate (longitude and latitude) * * Code from http://en.wikipedia.org/wiki/Geographic_coordinate_conversion * * @return string */ static function pretty_print_coordinates(midgardmvc_helper_location_spot $spot) { return $spot->__toString(); }
public function test_toString() { // Helsinki-Malmi airport (EFHF) $efhf = new midgardmvc_helper_location_spot(60.254558, 25.042828); $coordinates = $efhf->__toString(); $this->assertEquals('60°15′16″N 25°2′34″E', $coordinates); // Midgard airport (FYMG) $fymg = new midgardmvc_helper_location_spot(-22.083332, 17.366667); $coordinates = $fymg->__toString(); $this->assertEquals('22°4′59″S 17°22′0″E', $coordinates); }