Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LAT LON conversion to decimals appears to ignore compass ref #1

Open
stjagu opened this issue Jul 7, 2023 · 0 comments
Open

LAT LON conversion to decimals appears to ignore compass ref #1

stjagu opened this issue Jul 7, 2023 · 0 comments

Comments

@stjagu
Copy link

stjagu commented Jul 7, 2023

def gps_to_decimal(coord, ref):
    """
    Converts GPS coordinates to decimal degrees.

    Args:
        coord (tuple): A tuple containing the GPS coordinates.
        ref (str): The reference direction (e.g., N, S, E, W).

    Returns:
        float: The GPS coordinates in decimal degrees.
    """
    decimal = coord[0][0] / coord[0][1] + coord[1][0] / (60 * coord[1][1]) + coord[2][0] / (3600 * coord[2][1])
    if ref in ['S', 'W']:
        decimal *= -1
    return decimal

If I change S to N and W to E the results are the same, positive Coords rather than negative for N or E.

I added gps lat lon ref to see if it was reading, it returns b'N' and b'W'

'gps_latitude': gps_latitude_decimal,
'gps_latitude_ref': gps_latitude_ref,
'gps_longitude': gps_longitude_decimal,
'gps_longitude_ref': gps_longitude_ref,

Are you seeing same behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant