Jump to content
The simFlight Network Forums

Inaccurately latitude data from offset 0x0860?

Recommended Posts

Hi folks!

I registered FSUIPC a few days ago. :D

Because I know a little bit C#, I've tried out the FSUIPC SDK.

My first simple program reads the latitude data from FSUIPC, converts it into degrees (with the factor from SDK) and shows the result in a MessageBox.

To examine if my result is correct i used FSInterrogate2. Everything was fine.

My problem:

To verify my data I use the Flight Simulator's "debug line" (the line with lat, long, kias... accessible via keystroke CTRL-Z).

The latitude displayed by FS2004 always(!) differs from the value I've read through FSUIPC.

The FSInterrogate2 value read from offset 0x6010 (FS2004 GPS Latitude in degrees) equals to my programs value, but differs from FS2004's one.


FS2004 shows N50.45...

FSInterrogate2 and my prog shows 50.72... :shock:

The latitude value always differs with a factor from 0.2 to 0.5 degrees!

I've tested this behaviour on two different PC's, so I think it's not my fault :wink:

My config:

- WinXP SP2

- FS2004 German with update to version 9.1

- FSUIPC 3.50 (registered)


Has anybody an idea what the problem is? Or maybe who to solve?

THX a lot, Daniel Kraemer

P.S.: Sorry for my bad english but my native language is German 8)

Link to comment
Share on other sites


FS2004 shows N50.45...

FSInterrogate2 and my prog shows 50.72... :shock:

Check the units! FS's display shows degrees, minutes, and then either seconds or fractional minutes (depending on an FS9.CFG option). You and FSInterrogate are showing just degrees and fractional degrees.

50 degrees and 45 minutes would be 50.75 in degrees only. 50.72 degrees would be 50 degrees 43.2 minutes.

I've tested this behaviour on two different PC's, so I think it's not my fault :wink:

Hmmwell, it is really your fault ;-), but only in the sense that you are assuming that you and FS are displaying the values in the same way.

You need to know that though there are 100 hundredths of a degree in a degree, there are only 60 minutes in a degree. Similarly there are 60 seconds in a minute. You just need to do a bit more arithmetic. ;-)



Link to comment
Share on other sites

Thanks Pete! :D

OK, it was my fault :oops:

For the whole community - This is my solution:

			Fsuipc fs = new Fsuipc();

			int		fsToken		= 0;
			int		fsResult	= 0;
			long	latRead		= 0;
			double	latConv		= 0;
			int		latDegrees	= 0;
			double	latMinutes	= 0;

			const int		FSUIPC_LATITUDE_OFFSET	= 0x0560;
			const int		FSUIPC_LATITUDE_LENGTH	= 8;
			const double	FSUIPC_LATITUDE_FACTOR	= 2.095109e-015; /* 90.0 / (10001750.0 * 65536.0 * 65536.0) */
			const double	FS2004_MINUTE_FACTOR	= 60;

			fs.FSUIPC_Open(0, ref fsResult);
							ref fsToken,
							ref fsResult);
			fs.FSUIPC_Process(ref fsResult);
			fs.FSUIPC_Get(ref fsToken, ref latRead);

			/* Convert to degrees 
			 * Example: 
			 * readLat = 24282851155509248
			 * convLat = 50.875220001567826 */
			latConv = latRead * FSUIPC_LATITUDE_FACTOR;

			/* "full" degrees
			 * latDegrees = 50 */
			latDegrees = (int) latConv ;

			/* Multiply by 60 and
			 * Round to 4 digits (good accuracy for most applications)
			 * latMinutes = 52.5132 */
			latMinutes = (latConv - latDegrees) * FS2004_MINUTE_FACTOR;
			latMinutes = Math.Round(latMinutes, 4);

			/* Explanation: N50* 52.51 is the latitude from EDDK - Gate E10 ;-) */



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.