我从 garmin 设备收集的位置点以度分格式存储在 Excel 表中 --- W00208.172,N1046.977 如何将其转换为十进制度或度分秒格式?
3 回答
所以我一直在寻找一个懒惰的答案并且不高兴所以将把我最后所做的放在这里:
想要在这两种格式之间进行转换:
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 位数字并将其存储到递减:
deg = 002 然后将其余部分作为十进制分钟:
最小值 = 08.172
现在转换为十进制度 (DEG):
decDegrees = 度 + 分钟 / 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;
因此该位置应位于布基纳法索,靠近道路 15m(= 似是而非)Dununuai 东南 5,52 公里
此公式适用于 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))