Skip to content

Unable to parse common nautical representations #3

@ghost

Description

Common representations include:
12N33E // Should technically fail
12N033E // Works correctly
16N189E // Should fail (out of range)
16N0189E // Should work but doesn't
120021N 0273459E // Should work
56 32N 029 45W // Fails but valid
28 89.99S 80 88.00W // Fails but valid
-27 55.29 34 34.0 // Sloppy but valid
3530N1 12058E6 // With checksums
3530N2 12058E5 // With wrong checksums :-)

In general, white space can not be relied upon to signal the end of lat, only the N|S (or n|s), and you may still have to consume a checksum character - or the checksum char could be the start of the next letter.

Also, there are entries like:
45-89.0 N 088-5.0E
Be careful to consume the - or it will cause negative minutes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions