You are here

function _exif_DMS2D in Exif 6

Helper function to change GPS co-ords into decimals.

1 call to _exif_DMS2D()
_exif_reformat in ./exif.module
Helper function to reformat fields where required.

File

./exif.module, line 279
implementing the drupal api

Code

function _exif_DMS2D($value, $ref) {
  $parts = split('/', $value[0]);
  $dec = (double) ((double) $parts[0] / (double) $parts[1]);
  $parts = split('/', $value[1]);
  $dec += (double) ((double) $parts[0] / (double) $parts[1] / 60);
  $parts = split('/', $value[2]);
  $dec += (double) ((double) $parts[0] / (double) $parts[1] / 3600);
  if ($ref == 'S' || $ref == 'W') {
    $dec *= -1;
  }
  return $dec;
}