I have latitude/longitude represented as amount of seconds:
45'11"35 = 45*60*60 + 11*60 + 35 = 9720695
How can I convert back from something like 9720695 to DMS/Decimal?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communityI have latitude/longitude represented as amount of seconds:
45'11"35 = 45*60*60 + 11*60 + 35 = 9720695
How can I convert back from something like 9720695 to DMS/Decimal?
If you don't mind using Excel; you will get B1=45, C1=11, D1=35 with formula below.
A1: 162695
B1: =FLOOR(A1/3600, 1) # D
C1: =FLOOR((A1/3600 - B1)*60, 1) # M
D1: =A1-B1*3600-C1*60 # S
E1: =A1/3600 # Decimal
Sorry I did not notice you were QGIS user. The above excel formula is basically applicable to Field calculator. One pitfall is floor() for negative number so x is put in abs(). If your data isn't in west (e.g. -45'11"35 for 45'11"35W) or south this may be overkill.
x: 162695
D: floor(abs("x")/3600)
M: floor((abs("x")/3600 - floor(abs("x")/3600))*60)
S: abs("x")-floor(abs("x")/3600)*3600-(floor((abs("x")/3600-floor(abs("x")/3600))*60))*60