Re: Distance calculation

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Prashant Shah" <dr_prashants@xxxxxxxxxxx> wrote in message
news:uNR$o7aBIHA.324@xxxxxxxxxxxxxxxxxxxxxxx
Res.Mr.Harold Druss,
I thank you very much for quickly supplying the code for the distance
calculator. It will be of great help for me.

You wrote the function as

Public Function distance(lat1, lon1, lat2, lon2, unit) As Variant

What is the "Unit" is for?

You have given two examples in the Select case statement "K" and "N"

What are they?


Based on the values given, I would say that the unit is normally in miles,
and using a "K" as unit converts to kilometers. I would also guess that
using "N" converts to nautical miles, but assuming that's true, the
conversion is a bit off. It indicates multiplying by 0.8684, but a more
accurate value would be 0.8690 (or 0.8689762, depending on how accurate you
want to be).

FYI, the 1.1515 is a value to convert the distance to miles, based on an
average circumference of the earth (although based on standard values, I
think it should be a bit higher). As the Earth is not a true sphere, it's a
bit complex to get it exact. For more information you can check out:

http://en.wikipedia.org/wiki/Great-circle_distance

--
Regards,

Rick Raisley


.



Relevant Pages

  • Re: Elevation Calculator for Distant Object?
    ... >>ground distance from the observer to a point directly below the object. ... >>That is, as an example, suppose that I know I'm 400 miles from Los ... >>see a more general calculation. ... > earth, you could simplify this calculation enough that you might not ...
    (sci.astro.amateur)
  • Re: Why the sun is hot
    ... The distance from the Earth to the Sun is about 94 million miles. ... The Sun circles the Earth once every 24 hours in a roughly circular orbit. ...
    (sci.astro.amateur)
  • Re: Road traffic falls
    ... > fewer miles last year, the equivalent of 125,000 around-the-world ... > trips or 33 times the distance between the Earth and the Sun. ...
    (uk.transport)
  • [PHP] Re: Google Maps Distance Between UK Postcodes
    ... I should point out that this is really just trig and is only an approximate distance as the crow flies. ... Not even sure if it takes the curvature of the earth into consideration, but it's probably "good enough" for most things. ... Here's yet another "get distance" thing from lat/long, but it's for miles. ...
    (php.general)
  • Re: M25 Speed cameras
    ... Why not measure heights from the centre of mass of the earth-moon system? ... Earth radius 4000 miles, Moon distance 240000 miles. ...
    (uk.transport.london)