Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Calculating distance between geographic points

Featured Replies

Hi,I am fooling around with a small utility where I need to calculate the distance between two geographic points giving the latitude and longitude. More precisely I am trying to calculate the point at a given distance from the reference point. I am using the following formula, but my test shows that it is something like 10% off the size:longitude.Radian += distance.X / ((40075000.0 / (2.0 * Math.PI)) * Math.Cos(Latitude.Radian));latitude.Radian += distance.Y / (40007000.0 / (2.0 * Math.PI));I am aware that you should normally try to use the latitude between the two points, but my base point is always the center of the object, so I should be fine - and nothing will be bigger than 1km anyway.Does anyone have the correct parameters to use with Flight Simulator? I got these of the SDK but probably misunderstood one or another thing. My current formula use meters, but if I get something else, I think it is within my limits to convert it to meters (after all, I do not work for NASA). :)/Lars

Lars, I can't remember the spherical geometry formula for the distance between two points, but I DO remember there were a number of terms which contained the sines of angles VERY close to 0 with numbers like 0.00000000000001265 and the cos of angles VERY close to 1 like 0.9999999999749. Very small angles are subtended for most practical purposes when measuring small distances on the surface.So unless you use (VBA?) code which accomodates a very large number of decimal points, the final values will be off by a significant percentage.I assume you need real precision here that works across the whole planet.......:-bluegrab

Hi Lars.Here's a javascript website to calculate great circle distances for any 2 lat-long pairs:http://williams.best.vwh.net/gccalc.htmThe sourcecode can be viewed in Internet Explorer, and the author gives his e-mail address.You can save this webpage from IE, and you can then use it offline, if desired.Dick

This guy Williams must sleep with a globe beside his bed.........his paper was the one I used to transport the formula to Excel but found that small distances were not accurate...or at least they didn't agree with MicroSoft Streets and Trips.

Hmm, strange I managed to avoid that thread when searching, I must have typed wrong in the search :)As far as I can see, this formula is close to what I am having, except I tried to use the values of the SDK, so that might be the problem.I use the .Net framework so if needed I can use the decimal calss, but a double should do the trick. Notice that only one COS is used based on the latitude (not the distance between the points) so it should be fine.Thanks for the help, I will move on when time allows (long weekend coming up, so there is hope). Worst case I will just do some "reverse" calculation to find the required numbers, whatever they might be. :)/Lars

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.