How to format GPS latitude and longitude?

后端 未结 7 905
囚心锁ツ
囚心锁ツ 2021-01-04 07:48

In android(java) when you get the current latitude and longitude using the function getlatitude() etc you get the coordinates in decimal format:

latit

7条回答
  •  忘掉有多难
    2021-01-04 08:20

    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 negative value)

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

    Refer From: How to find degree from the latitude value in android?

    Convert Latitude and Longitude Values (Degrees) to Double . Java

提交回复
热议问题