Click or drag to resize
ICompactPositionReportingGlobalDecode Method
Decodes an early and later CPR coordinate into an unambiguous location on the surface of the globe. May return null if the location cannot be decoded.

Namespace: VirtualRadar.Interface.Adsb
Assembly: VirtualRadar.Interface (in VirtualRadar.Interface.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
GlobalCoordinate GlobalDecode(
	CompactPositionReportingCoordinate earlyCpr,
	CompactPositionReportingCoordinate laterCpr,
	GlobalCoordinate receiverLocation
)

Parameters

earlyCpr
Type: VirtualRadar.Interface.AdsbCompactPositionReportingCoordinate
The earlier of the two transmissions.
laterCpr
Type: VirtualRadar.Interface.AdsbCompactPositionReportingCoordinate
The later of the two transmissions. The OddFormat parameter must not be the same as the ealier coordinate's and the number of bits must be identical.
receiverLocation
Type: VirtualRadar.Interface.AdsbGlobalCoordinate
The location of the receiver on the globe. If this is null then 19-bit CPR coordinates will not be decoded, but 17-bit and below still will.

Return Value

Type: GlobalCoordinate
An object describing the location on the surface of the globe or null if the location could not be decoded.
Remarks

Surface position coordinates (19-bit format) always decode to two possible latitudes and four possible longitudes. It is impossible to unambiguously determine which of those eight locations is the correct one, so the one closest to 'receiverLocation' is always chosen. If the receiver location is unknown then null is returned for 19-bit formats. The receiver location is ignored for all other formats.

The spec suggests that two messages are only globally decoded if they arrive within a certain time frame (10 seconds for airborne position messages, 25 to 50 seconds for surface position messages). This method does not police those time frames, it's up to the caller to determine whether two messages are suitable for global decoding. This is important to note. The algorithm does NOT give the right result if the distance between the two locations at which the messages were transmitted is larger than 3 nautical miles (about 5.5km) for 17 bit messages or 0.25 nmi (about 1.38km) for 19 bit messages. I learnt this the hard way when I stared at the code until my eyes bled when a unit test that was decoding 19-bit messages 5km apart was failing. In the test the j value was consistently out by 1. I would recommend following the rules for testing the reasonableness of a globally decoded location as laid out in the ICAO documentation.

See Also