Jump to content

Algorithm (or fn) for Degrees-mins-secs to decimal?


Recommended Posts

Does AutoIt have (or failing this--can someone code me) a degrees-minutes-secs converter?

e.g. 50o 42' 43.33 = 50.712008

:)

We don't create scripts on request here. We help you write your own. A minute is just 1/60th of a degree, and a second is just 1/60th of a minute. So the math is easy: 50 + 42/60 + (43.33/60)/60

Try to code it and come back with a more specific question about using AutoIt if you need to.

:P

P.S. If you need someone to code it for you, see the Rent-A-Coder link in my sig. :P

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

;50o 42' 43.33 = 50.712008

$result = DMS2DEC(50,42,43.33)
ConsoleWrite($result & @CRLF)

$result2 = DEC2DMS($result)
ConsoleWrite($result2 & @CRLF)

Func DMS2DEC($fDegrees, $fMinutes, $fSeconds)
    Return $fDegrees + ($fMinutes/60) + ($fSeconds/3600)
EndFunc

Func DEC2DMS($fDec)
    Local $fDegrees, $fMinutes, $fSeconds
    $fDegrees = Int($fDec)
    $fMinutes = ($fDec - $fDegrees) * 60
    $fSeconds = StringFormat("%.2f",($fMinutes - Int($fMinutes)) * 60)
    Return StringFormat("%s° %s' %s""", $fDegrees, Int($fMinutes), $fSeconds)
EndFunc

We don't create scripts on request here. We help you write your own.

Oops. Sorry, first one of the day. I get more frustrated as the day progresses so I am less willing to help @ 5:00. Edited by weaponx
Link to comment
Share on other sites

Oops. Sorry, first one of the day. I get more frustrated as the day progresses so I am less willing to help @ 5:00.

Giving away fish in a caffeine-induced early morning frenzy... :)

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...