Praveen Praveen - 6 months ago 9
Android Question

How to find degree from the latitude value in android?

I have a latitude and longitude values as a double value(37.33168900, -122.03073100).

I want to convert it to the degree value like (37 19' 54 ,48 11' 52 ).

Any Idea? Thanx in advance.

Answer

Should be some math:

(int)37.33168                => 37
37.33168 % 1 = 0.33168       
0.33168 * 60 = 19,905        => 19
19.905 % 1 = 0.905
0.905 * 60                   => 54

same with -122 (add 360 if nagative value)

EDIT: May be there is some API, which I don't know.