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

Obscure Position Ambiguity Bug #90

Open
shackrat opened this issue Nov 5, 2024 · 0 comments
Open

Obscure Position Ambiguity Bug #90

shackrat opened this issue Nov 5, 2024 · 0 comments

Comments

@shackrat
Copy link

shackrat commented Nov 5, 2024

There's a bug in how position ambiguity is processed. It's likely due to a quirk in the spec..
The bug is when the parser throws a "latitude and longitude ambiguity mismatch" exception because the number of spaces in the latitude is not equal to the number of spaces in longitude. However, the spec does not require any spaces in longitude for position ambiguity.

From the spec (aprs101.pdf)

The level of ambiguity specified in the latitude will automatically apply to the longitude as well — it is not necessary to include any (space) characters in the longitude.

There are a couple ways to solve this, but I feel the cleanest is to simply ensure that longitude minutes (lon_min) has an equal number of spaces before processing the bounding box coordinates. Its two lines of code and the rest of the execution flow remains unchanged. (Technically, following the change, the exception could be removed as I don't see an occasion when it could ever be thrown)

I altered parsing/position.py as follows..

        # position ambiguity
        posambiguity = lat_min.count(' ')

        # From the spec (aprs101.pdf)
        #   The level of ambiguity specified in the latitude will automatically apply to the longitude as well
        #   — it is not necessary to include any (space) characters in the longitude.
        # We will assure that lon_min reflects this at all times
        if (posambiguity > 0):
            lon_min = lon_min[:len(lon_min)-posambiguity] + (posambiguity * ' ');

        if posambiguity != lon_min.count(' '):
            raise ParseError("latitude and longitude ambiguity mismatch")

I apologize for not doing a PR.. I have made other changes to the file as well.

Steve White
aprs.to

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