If you’re working with undocumented lat/long coordinate data and, when plotted, everything’s coming out sort of in the right place but a little way off, check to see whether or not what looks like decimal lat long data is actually traditional DMS data.

For example, I recently had to parse and plot a bunch of coordinates which looked like this: 6359550-2154605. I initially thought it was decimal lat/long data missing decimal points for some reason, so I plotted it as 63.59550, -21.54605. All of the coordinates were in the right place relative to each other, but about 1/3rd of a degree off. Turns out the data actually needed to be plotted as 63˚ 59' 55.0", -21˚ 54' 60.5".

Here’s the python I wrote to clumsily convert the strange original form into decimal:

def dms_to_decimal(old):
    if old[0] == '-':
        old = old[1:]
        multiplier = -1
    else:
        multiplier = 1

    return (int(old[0:2])+int(old[2:4])/60.0+int(old[4:6])/3600.0) * multiplier
updated: