Answered by:
Angle degree values to decimal values

Question
-
Hi,
I am passing the degree values in the form of "123:09:89".I want to convert this value into its exact decimal value.please suggest any solutions.
Tuesday, September 14, 2010 10:12 AM
Answers
-
Is the degree measurement in degrees, minutes, seconds? If so, then use 60 as your divisor.
123 + (9/60) + (89/ 60/ 60)
123 + .15 + .024722
123:09:89 -> 123.174722
In a more general formula:
result = degrees + (minutes/60) + (seconds/60/60)
There is a degree converter site here to use for testing your results:
http://rumkin.com/tools/gps/degrees.php
Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!- Marked as answer by chidambaranathan Wednesday, September 15, 2010 11:34 AM
Wednesday, September 15, 2010 6:11 AM
All replies
-
Is the degree measurement in degrees, minutes, seconds? If so, then use 60 as your divisor.
123 + (9/60) + (89/ 60/ 60)
123 + .15 + .024722
123:09:89 -> 123.174722
In a more general formula:
result = degrees + (minutes/60) + (seconds/60/60)
There is a degree converter site here to use for testing your results:
http://rumkin.com/tools/gps/degrees.php
Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!- Marked as answer by chidambaranathan Wednesday, September 15, 2010 11:34 AM
Wednesday, September 15, 2010 6:11 AM -
Hi,
Thanks for ur suggestion.can u please give some codes in vb.net
as i am new to vb.net.
Wednesday, September 15, 2010 11:36 AM -
I very rarely make this kind of post, but ...I can understand that you may simply have made a typing mistake in yourfirst post, when giving an example of a degree with more than 60 seconds,but if you can't code up basic arithmetic, I wonder if it was such a mistakeor if you simply don't have a proper understanding of what you are doing.Many people offer help here of their own free will, and at no cost, but thisis not a place to get your work done for you. I would say you are way out ofyour depth and should ask your manager for some training because you willcertainly fail when you have do something more complex.--Enjoy,Tonywww.WordArticles.com"chidambaranathan" wrote in messagenews:07584875-8091-4ebb-bd8e-0c787affde1b...> Hi,>> Thanks for ur suggestion.can u please give some codes in vb.net>> as i am new to vb.net.>>>
Enjoy,
Tony
www.WordArticles.comWednesday, September 15, 2010 12:51 PM -
I agree Tony. And LOL on the 89. I was so focused on the code I did not look closely at the example.
And Chi ... you should be able to just paste in the line I provided with the variables (result = ...). The only other thing you need to do is to declare the variables.
These are elementary tasks in any language.
Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!Wednesday, September 15, 2010 2:40 PM -
Thanks for ur help and I will follow ur advise..............Thursday, September 16, 2010 7:39 AM
-
Hi Deborah K,
U already suggested me solution to convert a dms value to degree.The problem in that is i am getting the dms value from RS232 cable. The value is in string format. I am splitting the string. My problem is when i get negative dms values then i should get negative decimal value. the suggestion which u provided is fine for for ordinary dms values.
i will explain u with examples,
for -158:02:00 it is -158.033333
and for 0:01:00 and -0:01:00 is -0.01666 and my code as follows
If
(no.Contains(":") = True) Then
d = CDbl(de(0))
m =
CDbl(de(1))
s =
CDbl(de(2))
d1 =
CDbl(su(0))
m1 =
CDbl(su(1))
s1 =
CDbl(su(2))
If d > 0 Then
mddms = d + (m / 60) + (s / 60 / 60)
Else
mddms = Math.Abs(d) + (m / 60) + (s / 60 / 60)
mddms = -mddms
End If
End If.
u r help is most welcomed.
Saturday, September 25, 2010 6:37 AM