

Hi, sorry to drop in this old discussion. The problem you posted in the other thread ( Any way to improve accuracy of conversions from lat,lon,alt to x,y,z coordinates?) is most likely not related to the calculation but to the limited precision of the input data. To store these numbers in a text file you would need 17 decimal digits (according to float.h) if you don't want to loose precision. If you write and read from a text file you are loosing precision: XPLMWorldToLocal and XPLMLocalToWorld use double precision floating point numbers as input and output. I also get a weird issue where my flight view gets distorted as I take-off but returns to normal during flight. Is there a way to make this calculation more accurate? The potential to replay flights outside x-plane improves dramatically if location can be accurately derived using world coordinates. I've read about the world coordinates (lon, lat & alt) being less precise so that's probably the reason. The flight is especially un-smooth when I set the local x, y & z values using values gotten when converting lon, lat & alt to local x,y,z coordinates. My current process and results don't feel far away from what i'm trying to achieve. I know others on this forum have completed similar projects as well from my readings, hopefully someone can point me in the right direction. Sandy I understand you've done a similar (if not exactly the same) project with your flightdataviewer. I expected the same flight to play seamlessly but what i got was more of a digitized flight than a continuous one (which makes some sense).

Then I start x-plane again, read and set these values in the plane every flight loop. Right now my first step is to run a flight in x-plane and store its (lon,lat,alt,x,y,z,vx,vy,vz,psi,theta,phi) into a txt file every flight loop. Right now my results are okay, but I would like the flight to be much smoother. I'm currently developing a plugin to drive planes on X-Plane 11.32. Also, the threads I would like to reply to are archived. This may be only slightly related since i'm new to the forum and have limitations. I have found that I needed to convert the altitude, you may not need to. XPLMWorldToLocal(dLatitude, dLongitude, dAltitude / 3.28, &dLocalX, &dLocalY, &dLocalZ) * try to avoid round tripping from local to world and back. * NOTE: world coordinates are less precise than local coordinates you should Latitude and longitude are in decimal degrees,

* This routine translates a local coordinate triplet back into latitude, * meters in the local OpenGL coordinate system. * and altitude is in meters MSL (mean sea level). * This routine translates coordinates from latitude, longitude, and altitude You need to use these functions in the XPLMGraphics.h header file
