import math


def latlon_distance_conversion(lat):
  """
  Given a latitude (in degrees), returns (mperlat,mperlon)
  where mperlat = meters per degree latitude,
  mperlon = meters per degree longitude.
  These calculations are based on a spherical earth, and were taken from
  http://www.nga.mil/MSISiteContent/StaticFiles/Calculators/degree.html
  """
  lat_rad = lat * 2.0 * math.pi / 360.0;
  m1 = 111132.92;
  m2 = -559.82;
  m3 = 1.175;
  m4 = -0.0023;
  p1 = 111412.84;
  p2 = -93.5;
  p3 = 0.118;
  
  latlen = m1 + (m2 * math.cos(2 * lat)) + (m3 * math.cos(4 * lat)) + \
      (m4 * math.cos(6 * lat));
  lonlen = (p1 * math.cos(lat)) + (p2 * math.cos(3 * lat)) + \
      (p3 * math.cos(5 * lat));

  return (latlen,lonlen);