将纬度/经度值(DMS+罗盘方向格式)转换为Android中相应的小数点值
我正在开发一个 Java android 项目并遇到以下问题。我搜索了很多,但仍然存在将 DMS 格式的纬度/经度值(例如:38°2'56''N、122°9'28''W)转换为相应的十进制度格式的问题。
需要转换为其相应的十进制度格式的示例值。
北纬 38°49'59'',东经 26°56'59''
北纬 38 °2'56'',西经 122°9'28
'' 南纬 34°52'58'',56°10'58''谢谢
你
I am working on an Java android project and have the following issue. I Searched so much but still I have the problem of converting the Latitude/Longitude values that are in DMS format (Eg: 38°2'56''N, 122°9'28''W) for their corresponding Decimal Degrees format.
Example values that need to be converted for their corresponding decimal degrees format.
38°49'59''N, 26°56'59''E
38°2'56''N, 122°9'28''W
34°52'58''S, 56°10'58''W
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以随时在此处使用 Sherif 公式检查您的工作:
http://transition.fcc.gov/mb/audio/bickel/DDDMMSS -十进制.html
And you can always check your work with Sherif's formula here:
http://transition.fcc.gov/mb/audio/bickel/DDDMMSS-decimal.html
将 DMS 转换为十进制时,您所做的就是除以 60。将 S 除以 60,将其与 M 相加,将结果除以 60,然后将其与 D 相加。
第二部分处理坐标点的方向。想象一对轴,罗盘方向位于正确的位置(即,向上是 N,向右是 E,向下是 S,向左是 W)。这意味着与指向 S 或 W 的 DMS 值对应的任何十进制度值都将为负数。
北纬 38°2'56'',西经 122°9'28'' -> 38.048889, -122.157778
All you're doing when you convert DMS to decimal degrees is dividing by 60. Divide S by 60, add it to M, divide that result by 60, then add it to D.
The second part deals with the direction that the coordinates point. Picture a pair of axes with compass directions in their correct locations (i.e., up is N, right is E, down is S, left is W). This means that any decimal degree value corresponding to a DMS value that pointed either S or W is going to be negative.
38°2'56''N, 122°9'28''W -> 38.048889, -122.157778
D°M'S''
摘要
从 DMS 转换为 DEGREE
度数 = D + ( (S/60)+M)/60
其中 D、M 和 S 是构成 DMS 格式的值:D°M'S''
D°M'S''
SUMMARY
TO CONVERT FROM DMS TO DEGREE
Degrees = D + ((S/60)+M)/60
Where D and M and S are the values that compose the DMS format : D°M'S''