Michael A Posted January 1, 2005 Report Posted January 1, 2005 Hello, Things are going wonderful now. I just have a question for a delphi programmer that has successfully got the latitude and longitude to display correctly. The offset table guide to this section is just a little hard to understand. Your help is appreciated. Thankyou, Michael.
CATIII Posted January 3, 2005 Report Posted January 3, 2005 Mick, some excerpts from my code (free to use but no guarantee): var Lat_FS, Long_FS: Comp; // $0560, 8 / $0568, 8 (in FS format) Latitude, Longitude : Double; FSUIPC_Read($0560, 8, @Lat_FS, dwResult); // Latitude of A/C FSUIPC_Read($0568, 8, @Long_FS, dwResult); // Longitude of A/C function Decode_FS_Latitude_to_Decimal(lat : comp) : Double; begin Result := lat * 90 / (10001750.0 * 65536.0 * 65536.0); end; function Decode_FS_Longitude_to_Decimal(lon : comp) : Double; begin Result := lon * 360 / (65536.0 * 65536.0 * 65536.0 * 65536.0); end; // Extract and display current position of aircraft Latitude := Decode_FS_Latitude_to_Decimal(Lat_FS); Longitude := Decode_FS_Longitude_to_Decimal(Long_FS); if Latitude >= 0 then begin Label_Lat.Caption := 'N ' + FormatFloat('0.00', Latitude) + '°'; end else begin Label_Lat.Caption := 'S ' + FormatFloat('0.00', Latitude) + '°'; end; if Longitude >= 0 then begin Label_Lon.Caption := 'E ' + FormatFloat('0.00', Longitude) + '°'; end else begin Label_Lon.Caption := 'W ' + FormatFloat('0.00', Longitude) + '°'; end; This should get you up and running... Bye, CATIII Edit: 'greater than' changed to 'greater than or equal to'.
Michael A Posted January 4, 2005 Author Report Posted January 4, 2005 Thank you CATIII, Exactly what I was looking for. Well Done =) Regards, Michael. PS. I have all the stuff i need now, but the only part that has me a little baffled is the heading equation.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now