Search code examples
coordinatescoordinate-systems

59-60 second Coordinate issue


everyone, who read this.

I found an issue that latitude or longitude of geocoordinate with, for example, 2 minutes and 59 seconds, after converting to decimal format, has value "0.049722", but

  • 2 minutes and 60 seconds has value "0.35", but I thought it must be equal to equal to

  • 3 minutes and 00 seconds, that has value "0.05"

  • 3 minutes and 00 seconds, that has value "0.05"

But again 2 minutes and 61 seconds, that has expected value "0.050278"

Is it global geocoordinate issue or online converter issue?

I use http://the-mostly.ru/konverter_geograficheskikh_koordinat.html


Solution

  • When looking at the source of the respective website, you notice the following line:

    if (LAsec==60) {LAsec = 0;LAminutes = LAminutes+1;}
    

    Since LAminutes is still a string, this represents a string concatenation, so 2 is converted to 21 instead of 3.

    See: javascript (+) sign concatenates instead of giving sum?

    In short, the website is very wrong!

    Maybe you should use WolframAlpha for this: https://www.wolframalpha.com/input/?i=0+deg+2%27+60%22+N,+0+deg+E