-# This needs to check for leading 0 to disambiguate some things
-def DecDegree(Attr,Type):
- Parts = re.match('[+-]?(\d*)\\.?(\d*)?',GetAttr(Attr,Type)).groups();
- Val = string.atof(GetAttr(Attr,Type));
-
- if (abs(Val) >= 1806060.0):
- raise ValueError,"Too Big";
-
- # Val is in DGMS
- if abs(Val) >= 18060.0 or len(Parts[0]) > 5:
- Val = Val/100.0;
- Secs = Val - long(Val);
- Val = long(Val)/100.0;
- Min = Val - long(Val);
- Val = long(Val) + (Min*100.0 + Secs*100.0/60.0)/60.0;
-
- # Val is in DGM
- elif abs(Val) >= 180 or len(Parts[0]) > 3:
- Val = Val/100.0;
- Min = Val - long(Val);
- Val = long(Val) + Min*100.0/60.0;
-
- if Val >= 0:
- return "+" + str(Val);
- return str(Val);