I am developing C# code that reads 1090ES Automatic Dependent Surveillance - Broadcast (ADS-B).
The ADS-B position messages broadcast by the aircraft's ADS-B transmitter have a different encoding depending on whether the aircraft is airborne or on the ground.
When I decode Airborne Position frames as Compact Position Reporting (CPR) encoded positions, I get realistic results. However, when I decode the CPR for Surface Position frames, the positions I get are far (geographically) from what I should get.
How is the CPR in Surface position messages different from airborne position messages and how are they decoded properly?