耗时数分钟?

编程入门 行业动态 更新时间:2024-10-10 04:24:38
本文介绍了耗时数分钟?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

Google Maps用十进制表示法给我一个位置的纬度和经度,

Google Maps gives me the Lat and Long of a location in decimal notation like this:

38.203655,-76.113281

38.203655,-76.113281

如何将它们转换为坐标(度,分,秒)

How do I convert those to Coords (Degrees, Minutes , Seconds)

推荐答案

38.203655是度的十进制值.一分钟有60分钟,一分钟有60秒(1度== 60分钟== 3600秒).

38.203655 is a decimal value of degrees. There are 60 minutes is a degree and 60 seconds in a minute (1degree == 60min == 3600s).

因此,取值的小数部分,即0.203655,乘以60,得到分钟,即12.2193,即12分钟,然后重复分钟的小数部分,即0.2193 = 13.158000秒.

So take the fractional part of the value, i.e. 0.203655, and multiply it with 60 to get minutes, i.e. 12.2193, which is 12 minutes, and then repeat for the fractional part of minutes, i.e. 0.2193 = 13.158000 seconds.

python中的示例:

Example in python:

def deg_to_dms(deg): d = int(deg) md = abs(deg - d) * 60 m = int(md) sd = (md - m) * 60 return [d, m, sd] print deg_to_dms(38.203655) print deg_to_dms(-76.113281)

更多推荐

耗时数分钟?

本文发布于:2023-10-26 06:32:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529357.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!