Вопрос

I have location points collected from a garmin device stored in an excel sheet in Degree Minutes format --- W00208.172,N1046.977 How can I convert it to either Decimal Degrees or Degrees Minutes seconds Format ?

Это было полезно?

Решение 2

The range of longitude (E or W) is -180 to 180, so 3 digits The range of latitude (N or S) is -90 to 90, so 2 digits

Take "W00208.172", take the first 3 digits and store it to degress:

deg = 002 Then take the rest as decimal minutes:

min = 08.172

Now convert to decimal degrees (DEG):

decDegrees = deg + min / 60.0

Same for latitude: except that degrees are now only 2 digits N1046.977: Take 10 degrees, and 46.977 minutes.

For both think if you want to keep the "W" symbol:
Often it is better to mutiply with -1 in case of of "W" or "S", do this as last step in your conversion! Negative decimal degrees means W (for longitude) or S (for latitude).

For your provides coordinates that means:
lat: North 10046.977 = 10 + 46.977 / 60 = 10.78295;
lon: (2 + 8.172 / 60) * -1 = -2.1362;
so that location should be in Burkina Faso, 15m near a road (= plausible) 5,52 km south east east of Dununuai

Другие советы

So I was looking for a lazy answer and wasn't happy so gonna put here what I made in the end:

Wanting to convert between these two formats:

33°59'05.5"S 22°39'42.7"E and -33.98485,22.66186

The left being "Degrees Minutes Seconds" and the right being "Decimal"

Of course I have to make some assumptions so they are that it assumes your are following the above formats exactly.

Ok so first is from Degree to Decimal (the source being in cell 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)

And then from Decimal to Degree (the source being in cell 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")

If only you could have variables in formulae... most of that is duplicate formulae with some simple enough rules...Anyway, hope it helps someone.

This formula works on Google Sheets for converting from the format 018°40.1333 to 18.66888833 and -34°01.0597 to -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))
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top