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)更多推荐
耗时数分钟?
发布评论