The simFlight Network Forums

# Lat and long [c++]

## Recommended Posts

Hi ,

I have 2 questions :

How to get the latitude and longitude of the plane ? (like N47*19.79 E3*1.79 ....)

I don’t know if it’s possible, I want to know the distance covered in MN (sorry i don’t know the real expression in English )

In C++ with Devc++

Thanks :wink:

##### Share on other sites

":5f4f9]

How to get the latitude and longitude of the plane ? (like N47*19.79 E3*1.79 ....)

From a program, via the FSUIPC interface, all the details you need are in the FSUIPC SDK. Download that from http://www.schiratti.com/dowson.

I don’t know if it’s possible, I want to know the distance covered in MN (sorry i don’t know the real expression in English )

Distance convered from one place to another, you mean, or the whole squiggly route of a meandering aircraft? Obviously place-to-place distances have to be computed by normal spherical trigonometry given the two lat/long pairs. For the actual distance along a random route I can only think that you have to measure it from turn to turn, continuously, and sum it yourself.

Regards,

Pete

##### Share on other sites

Hi,

I don't understand all in "To convert to Degrees:" in the sdk (because i am french and my english is poor )

could you give me the code for to convert in degrees ? in c++

thanks

##### Share on other sites

":9ae56]

I don't understand all in "To convert to Degrees:" in the sdk (because i am french and my english is poor

It really isn't in English or French, but in Maths. Maths is pretty much the same in any language.

Just read the two values into _int64 variables, then copy them to doubles (the conversion to floating point will be done by the compiler) and then simply multiply and divide as shown. It isn't at all complicated, there are only multiplications (*) and divisions (/) involved!

Regards,

Pete

##### Share on other sites

• 3 weeks later...

I'm also working with lat, lon through FSUIPC. Once I convert the data, I seem to be getting better resolution in latitude (decimal places corresponding to movement in feet) than in latitude (movement in 10's to 100's of feet). Is this a limitation of the representation in Flight Simulator, or is there something that can be done to more accurately measure location? I'm trying to measure helo movement at hover, and with 10ft increments, I get zero variation.

The Fs units are designed to provide the maxiumum resolution in 64 bits, without even any "waste" due too a separate exponent as with floating point. So the whole possile 360 degree in Longitude uses all 64 bits, as does the 180 degrees of Latitude.

At the equator, where Latitude/Longitude angles represent the same distance, you would therefore expect the resolution to be twice a good in latitude.

I've not worked out the actual figures, but I am pretty sure you have an error if you are only getting 10-100 feet -- things like buildings and runways, all scenery in fact, is laid down using the same units.

Regards,

Pete

## Create an account

Register a new account