/** * Represents this instance as a string * * @return string */ public function __toString() { // Figure out cardinal directions $latDir = $this->isN() ? 'N' : 'S'; $lonDir = $this->isW() ? 'W' : 'E'; // Get the lat/lon as positive values $lat = $this->lat->deg >= 0 ? $this->lat : $this->lat->copy()->negate(); $lon = $this->lon->deg >= 0 ? $this->lon : $this->lon->copy()->negate(); return "{$lat} {$latDir}, {$lon} {$lonDir}"; }