Convert from Degrees Minutes Seconds to Decimal Degrees in Python

def latDD(x):
  x = re.findall("\d+", x)
  print x
  D = int(x[0])
  M = int(x[1])
  S = float(x[2] + "." + x[3])
  DD = D + float(M)/60 + float(S)/3600
  return DD

print latDD("40°36'34.81")


Happy GISing!
Lindsy Hales Bentley

Popular posts from this blog

How to Transfer Domains to a New Database

Calculate Station from Decimal