Sign in to follow this  
Followers 0
dazza

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

5 posts in this topic

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

e.g. 50o 42' 43.33 = 50.712008

:)

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

;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

Share this post


Link to post
Share on other sites

Many thanks!

:)

Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0