4
votes

I am working on a tool to find the distance between two points whose latitude and longitude are given. Its ok when the latitude and longitude is given in Signed Degree Format. But I couldn't find a way to calculate the distance when latitude and longitude is given in Degree Minutes Seconds Format (ex: N 11° 14' 52').Can anybody suggest me a way to find the distance ?

1
Well, a Google search revealed satsig.net/degrees-minutes-seconds-calculator.htmlc.
A second is a 1/60 of a minute, and a minute is 1/60 of a degree. So, decimal format = Degree + Minute/60 + Second/3600. North and East are considered positive.TreyA

1 Answers

1
votes

So first convert the DMS coordinates to your degree format.

e.g. 11°14'52" = 11 + 14/60 + 52/3600 = 11.24777778 degrees

and then continue as you did with your destance calculation that you say already works.


Edit:

sign(degrees) * (abs(degrees) + minutes/60 + seconds/3600)