Search code examples
phpcoordinatesgeodegrees

Converting DDM to DEC (Decimal degrees)


I have a set of coordinates in the format DDM (Degrees decimal minutes), that i need to convert to decimal degrees. From the function found here i can convert DMS, but i have failed to find a function or formula that will allow me to change DDM into DEC.

For example the coordinate could be:

64 Degrees 0 Minutes N, 22 Degrees 33 Minutes W

From the conversion tool here i know that the result is: 64, -22,55

So the question is how can I convert the DDM format ?

EDIT:

The data comes from a table that looks like this:

[Latitude_degrees]: 64
[Latitude_minutes]: 0
[Latitude_hemisphere]: N
[Longitude_degrees]: 22
[Longitude_minutes]: 33
[Longitude_hemisphere]: W

Solution

  • Simple mathematics

    As pseudocode:

    Latitude = Latitude_degrees + Latitude_minutes / 60 
    if Latitude_hemisphere = 'S' then 
        Latitude = -Latitude
    

    and the equivalent for Longitude