AnsweredAssumed Answered

Simple Python Field Calculator ex, converting degrees minutes & seconds to decimal

Question asked by mimiller on Dec 17, 2012
Latest reply on Dec 18, 2012 by mimiller
Afternoon all,

I'm trying to use the field calculator (Python parser) to convert a field of degrees/minutes/seconds(DMS) to decimal degrees.  The DMS field (latTemp) is formatted as such; 463704, 462331, etc. I'm trying to apply to the calculation to a decimal field (Latdecimal).

Pre-Logic code:
def lat(dms)     deg = !latTemp![0:2]     min = !latTemp![2:4]     sec = !latTemp![4:6]     dms = deg + (min / 60) + (sec / 3600)     return dms

Expression:
lat( !latTemp!)


I'm relatively new to python and am confused at this point.

Thanks for suggestions.

Outcomes