getDecimalFromDegree method

dynamic getDecimalFromDegree(
  1. double deg,
  2. double min,
  3. double sec
)

Returns the decimal value of a lat or long coordinate given its degrees minutes and seconds

Implementation

getDecimalFromDegree(double deg, double min, double sec) {
  double decimalDegree = deg;
  if (decimalDegree < 0) { //turns the decimal degree positive for the calculation
    decimalDegree *= -1;
  }
  decimalDegree += (min/60);
  decimalDegree += (sec/3600);

  if (deg < 0) { //turns the decimal degree back to negative if the original degree was
    decimalDegree *= -1;
  }
  return decimalDegree;
}