Jump to content
The simFlight Network Forums

Reading Lat & Long from FSUIPC returns odd values


Recommended Posts

Hey!

I have a problem once again, i'm trying to read the current Longitude & Latitude of my aircraft in FS, but using this code:'

Dim dwResult As Long

Dim longfake As Currency

Dim currentLong As Double

Call FSUIPC_Read(&H568, 8, VarPtr(longfake), dwResult)

Call FSUIPC_Process(dwResult)

currentLong = longfake * 10000#

currentLong = currentLong * 360# / (65536# * 65536# * 65536# * 65536#)

longitude.Text = currentLong

------------------------------------------------------------------------------------------

It returns something like this:

-123,029740092334

Thats not what i want? :shock:

Link to comment
Share on other sites

You say the value isn't what you want, but is it correct?

While you do not say where the aircraft actually is, I would guess that you are trying your code with the default FSX starting flight near Friday Harbor which does in fact have a longitude near -123.029740092334 in decimal degrees notation which is what your code is written to return.

If you want it to appear in another format like degrees minutes seconds (e.g. W123 1' 47'') or degrees and decimal minutes e.g. (W123 1.784') you are going to have to do the conversion yourself.

Jeff

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.