• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Algorithm to Calculate Lat/Long based on distance from central Lat/Long


Resource contributor
This may be extremely simple, but the math seems to be escaping me and my research hasn't given me a definite answer.

I have an object with several vertices whose position from the origin is known in meters. (X and Y). We will assume the object is flat.
I also know the object origin is at a given location. (example 13N, 51W).
How can one calculate the lat/long coordinate of every vertex given their X and Y distance from the origin?


Resource contributor
Finally found the answer,

It wasn't as straight forward as imagined.

Code modified from here:

function get_new_coordinates(central_coord:TCoordinate; X,Y: real):Tcoordinate;
const R:real = 6378137;  //Earth Radious in M
var central_lat,central_long,new_lat,new_long,bearing, distance: real;
  //Degrees to Radians
  central_lat := central_coord.lat * (pi/180);
  central_long := central_coord.long * (pi/180);

  bearing := ArcTan2(Y,X);
  distance := sqrt(sqr(X)+sqr(Y));

  new_lat := arcsin(sin(central_lat)*cos(distance/R) + cos(central_lat)*sin(distance/R)*cos(bearing));
  new_long := central_long + arctan2(sin(bearing)*sin(distance/R)*cos(central_lat),cos(distance/R)-sin(central_lat)*sin(new_lat));

  //back to degrees
  new_lat := new_lat * (180/pi);
  new_long := new_long * (180/pi);

  //round to 8 decimal places
  result.lat := roundto(new_lat,-8);
  result.long := roundto(new_long,-8);



Resource contributor
To add to Ed's answer; Ed Williams presents the formulae and worked examples so clearly that it is really easy to convert to C-code and then to plug in his examples to make sure your code is correct. BTDT and written a shedload of black boxes so I don't have to do it again.