Skip to content

Erroneous GPS coordinates from AIS Messages possibly with "null" values #393

@Bucket1616

Description

@Bucket1616

While tracking down an issue in SignalK/n2k-server, I found that if an ATON sends out a location update that looks like this:

{
  "pgn": 129041,
  "prio": 4,
  "src": 20,
  "dst": 255,
  "timestamp": "2026-02-03T00:54:37.244Z",
  "description": "AIS Aids to Navigation (AtoN) Report",
  "fields": {
    "messageId": "ATON report",
    "repeatIndicator": "First retransmission",
    "userId": null,
    "longitude": -111.8481066,
    "latitude": -111.8481066,
    "positionAccuracy": "Low",
    "raim": "not in use",
    "timeStamp": "0",
    "lengthDiameter": 2,
    "beamDiameter": 2,
    "positionReferenceFromStarboardEdge": 1,
    "positionReferenceFromTrueNorthFacingEdge": 1,
    "atonType": "Default: Type of AtoN not specified",
    "offPositionIndicator": "No",
    "virtualAtonFlag": "Yes",
    "assignedModeFlag": "Autonomous and continuous",
    "spare": 0,
    "positionFixingDeviceType": "Surveyed",
    "reserved19": null,
    "atonStatus": 0,
    "aisTransceiverInformation": "Channel A VDL reception",
    "reserved22": null,
    "atonName": "ROXK@@@@@@@@@@@@@@@@"
  },
  "id": "aisAidsToNavigationAtonReport"
}

The userId being null causes SignalK to assume the message has a context of "Self". This has been found and addressed in SignalK/n2k-server#2308, and prevents a mis-behavaing AIS device from causing the "Self" position to move to something like "-111.8481066,-111.8481066", as is seen in the above example. (This caused continuous false alarm problems with the Anchor Alert plugin.)

I tried to track down where these position numbers are coming from in code with the help of Google Gemini, but could not for the life of me find it. It's possible that this is what is actually being sent out by the ATON. Ideally, if the value is null, which Gemini seemed to think this was a number that could results from a 7FFFFFFF value being mis-converted, the value should create a Delta with a position of (null, null), not some wrong, but possible coordinates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions