Jump to content
The simFlight Network Forums

Writing Latitude and Longitude to Offsets


Recommended Posts

Hi Pete,

I'm trying to figure out how to format/convert latitude and longitude values (both of which I have in degrees) so I can use a Lua script to write these values to offsets 0x560 and 0x0568. I don't understand what the appropriate units are for writing to these offsets, and what the appropriate ipc.write command to use would be. The goal here is to move an aircraft to a lat-long location. I would appreciate any suggestions.

Thx,

Al

Link to comment
Share on other sites

Pete,

I think I figured it out. I need to 'reverse' the calculations you show for converting offset 0x0560 and 0x568 to degrees in order to get back to the flight sim format (whatever that is) for latitude and longitude, and then use the ipc.writeDD() command to write these values back to offsets 0x0560 and 0x0568.

Al

Link to comment
Share on other sites

1 hour ago, ark1320 said:

I think I figured it out. I need to 'reverse' the calculations you show for converting offset 0x0560 and 0x568 to degrees in order to get back to the flight sim format (whatever that is) for latitude and longitude, and then use the ipc.writeDD() command to write these values back to offsets 0x0560 and 0x0568.

Yes. The details shown in the offsets list show the way to convert the other way, for READING the Lat/Lon, which is the more usual application. All of the unit conversions sohwn in the whole documwent are that way around.

The strange units were designed (way back in SubLogic days I think, presumably when floating point was slow or maybe not even universal), to accommodate the most precision in a fixed point integer. 

Pete

 

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.