I need to convert lat/long that is expressed as degrees, minutes, and seconds in the data into decimal degrees. For example, in the data, they are listed as N335042.06 in the Latitude column, and W86031.04 in the Longitude column. I have done this problem before where I created a script which converted DMS to DD, and vice-versa, so I guess I could use bits from that. But the problem I'm having is how to ignore (for lack of a better word) the 'N' and 'W' in the data? Can I skip them? And DMS are listed all together without any symbols or spaces.
Can I use
split() to specify what part to read from the value? For example, can do the following?
N335042.06 where, 33 = degrees 50 = minutes 42.06 = seconds ...?
I came across this ESRI article, but it's in VB. Will probably use it as a reference but some of the terminology/syntax is different from Python.
Final code that works!
# Pre-logic def latDD(x): D = int(x[1:3]) M = int(x[3:5]) S = float(x[5:]) DD = D + float(M)/60 + float(S)/3600 return DD # Expression latDD(!Latitude!)