我从 garmin 设备收集的位置点以度分钟格式存储在 excel 工作表中---W00208.172,N1046.977如何将其转换为十进制度或度分秒格式?
所以我正在寻找一个懒惰的答案,并不高兴,所以最后要把我所做的放在这里:
想要在这两种格式之间进行转换:
33°59'05.5"S 22°39'42.7"E
和-33.98485,22.66186
左边是"度分秒",右边是"十进制"
当然,我必须做出一些假设,因此它们假设您完全遵循上述格式。
好的,所以首先是从度到十进制(源在单元格 B2 中):
=ROUNDDOWN(if(mid(B2,find(" ",B2)-1,1)="S","-","")&mid(B2,1,find("°",B2)-1)+mid(B2,find("°",B2)+1,find("'",B2)-find("°",B2)-1)/60+mid(B2,find("'",B2)+1,find("""",B2)-find("'",B2)-1)/60/60,5)&","&rounddown(if(right(B2,1)="W","-","")&mid(right(B2,find(" ",B2)-1),1,find("°",right(B2,find(" ",B2)-1))-1)+mid(right(B2,find(" ",B2)-1),find("°",right(B2,find(" ",B2)-1))+1,find("'",right(B2,find(" ",B2)-1))-find("°",right(B2,find(" ",B2)-1))-1)/60+mid(right(B2,find(" ",B2)-1),find("'",right(B2,find(" ",B2)-1))+1,find("""",right(B2,find(" ",B2)-1))-find("'",right(B2,find(" ",B2)-1))-1)/60/60,5)
然后从十进制到度(源在单元格 C2 中):
=abs(ROUNDDOWN(left(C2,find(",",C2)-1))) & "°" & ROUNDDOWN((abs(left(C2,find(",",C2)-1))-abs(ROUNDDOWN(left(C2,find(",",C2)-1))))*60) & "'" & round(((abs(left(C2,find(",",C2)-1))-abs(ROUNDDOWN(left(C2,find(",",C2)-1))))*60- rounddown((abs(left(C2,find(",",C2)-1))-abs(ROUNDDOWN(left(C2,find(",",C2)-1))))*60))*60,1) & """"&if(value(left(C2,find(",",C2)-1))<0,"S","N")& " " & abs(ROUNDDOWN(RIGHT(C2,len(C2)-find(",",C2)))) & "°" & rounddown((abs(RIGHT(C2,len(C2)-find(",",C2)))-abs(ROUNDDOWN(RIGHT(C2,len(C2)-find(",",C2)))))*60) & "'" & round(((abs(RIGHT(C2,len(C2)-find(",",C2)))-abs(ROUNDDOWN(RIGHT(C2,len(C2)-find(",",C2)))))*60- rounddown((abs(RIGHT(C2,len(C2)-find(",",C2)))-abs(ROUNDDOWN(RIGHT(C2,len(C2)-find(",",C2)))))*60))*60,1) & """"&if(value(right(C2,len(C2)-find(",",C2)))<0,"W","E")
要是公式中能有变量就好了...其中大部分是重复的公式,有一些足够简单的规则......无论如何,希望它对某人有所帮助。
经度范围(E 或 W)是 -180 到 180,所以 3 位数字纬度范围(N 或 S)是 -90 到 90,因此 2 位数字
取"W00208.172",取前 3 位数字并存储到递量:
度 = 002然后将其余部分作为小数分钟数:
分钟 = 08.172
现在转换为十进制度 (DEG):
十度 = 度 + 分钟/60.0
纬度相同:除了度数现在只有 2 位数字N1046.977:需要 10 度 46.977 分钟。
对于两者,请考虑是否要保留"W"符号:
通常,在"W"或"S"的情况下,最好使用 -1,这是转换的最后一步!负十进制度表示 W(表示经度)或 S(表示纬度)。
对于您提供的坐标,这意味着:
纬度:北 10046.977 = 10 + 46.977/60 = 10.78295;
lon: (2 + 8.172/60) * -1 = -2.1362;
所以那个位置应该在布基纳法索,靠近杜努努艾东南 5,52 公里的道路(= 合理)15m
此公式适用于 Google 表格,用于从格式 018°40.1333 转换为 18.66888833 和 -34°01.0597 转换为 -34.01766167
=IF(MID(B2,1,1) = "-", (INT(MID(B2, 1, SEARCH("°", B2) - 1)) - MID(B2, SEARCH("°", B2) + 1, len(B2))/60), (INT(MID(B2, 1, SEARCH("°", B2) - 1)) + MID(B2, SEARCH("°", B2) + 1, len(B2))/60))