转换度分到十进制度
我有一个存储在Excel表格中的Garmin设备的位置点,以度分钟格式存储— W00208.172,N1046.977如何将它转换为十进制度数或度数分钟格式?
经度范围(E或W)为-180至180,所以3个数字纬度范围(N或S)为-90至90,所以2个数字
取“W00208.172”,取前3位数字并存入:
deg = 002然后以小数分钟为单位:
分钟= 08.172
现在转换成十进制度(DEG):
decDegrees = deg + min / 60.0
纬度相同:除了现在只有2位数N1046.977:取10度和46.977分钟。
对于这两个想法如果你想保持“W”符号:
在“W”或“S”的情况下,通常最好多用-1,这是你转换的最后一步! 负小数度表示W(对于经度)或S(对于纬度)。
对于您提供的坐标,这意味着:
lat:北10046.977 = 10 + 46.977 / 60 = 10.78295;
lon:(2 + 8.172 / 60)* -1 = -2.1362;
所以这个位置应该在布基纳法索15米附近的一条公路(=似是而非)东南约5,52公里的东南部
所以我正在寻找一个懒惰的答案,并不高兴,所以要在这里把我所做的最后:
想要在这两种格式之间进行转换:
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")
如果只有你可以在公式中有variables…大部分是用一些简单的规则重复公式…无论如何,希望它可以帮助别人。
此公式适用于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))