League\Geotools\Convert\Convert::toDegreesMinutesSeconds PHP Method

toDegreesMinutesSeconds() public method

{@inheritDoc}
public toDegreesMinutesSeconds ( $format = ConvertInterface::DEFAULT_DMS_FORMAT )
    public function toDegreesMinutesSeconds($format = ConvertInterface::DEFAULT_DMS_FORMAT)
    {
        $latitude = $this->parseCoordinate($this->coordinates->getLatitude());
        $longitude = $this->parseCoordinate($this->coordinates->getLongitude());
        return strtr($format, array(ConvertInterface::LATITUDE_SIGN => $latitude['positive'] ? '' : '-', ConvertInterface::LATITUDE_DIRECTION => $latitude['positive'] ? 'N' : 'S', ConvertInterface::LATITUDE_DEGREES => $latitude['degrees'], ConvertInterface::LATITUDE_MINUTES => $latitude['minutes'], ConvertInterface::LATITUDE_SECONDS => $latitude['seconds'], ConvertInterface::LONGITUDE_SIGN => $longitude['positive'] ? '' : '-', ConvertInterface::LONGITUDE_DIRECTION => $longitude['positive'] ? 'E' : 'W', ConvertInterface::LONGITUDE_DEGREES => $longitude['degrees'], ConvertInterface::LONGITUDE_MINUTES => $longitude['minutes'], ConvertInterface::LONGITUDE_SECONDS => $longitude['seconds']));
    }

Usage Example

 /**
  * Returns a degrees/minutes/seconds representation of the coordinate
  *
  * @return StringLiteral
  */
 public function toDegreesMinutesSeconds()
 {
     $coordinate = static::getBaseCoordinate($this);
     $convert = new Convert($coordinate);
     $dms = $convert->toDegreesMinutesSeconds();
     return new StringLiteral($dms);
 }