1. [off topic] distance

Hi all, off topic question... does anyone already have code for determining
Earth surface distance, given latitude and longitude points of two locations?

Kat

new topic     » topic index » view message » categorize

2. Re: [off topic] distance

Kat,

Since no-one else has moved so far, try the following function. It's
pretty rough, but it should be reasonably accurate for distances up
several hundred kilometers. If you want your answer in miles, just
divide the returned value by 1.609.

jiri

--  earth.ex
--  jbabor at paradise.net.nz
--  00-12-28

constant R = 6371.02        -- mean earth radius in km
constant pi = 3.141593      -- close enough
constant d2r = pi/180       -- degrees-to-radians (~0.0174533)
constant c = d2r * R        -- ~111.1953 km per degree latitude

function distance(atom la1, atom lo1, atom la2, atom lo2)
    atom u,v

    u = (lo2-lo1) * (cos(d2r*la1) + cos(d2r*la2)) / 2
    v = la2-la1
    return c * sqrt(u*u + v*v)
end function

? distance(41.3, 174.7, 37.0, 174.7)    -- Wellington-Auckland
? distance(41.3, 174.7, 33.7, 151.3)    -- Wellington-Sydney

----- Original Message -----
From: "Kat" <gertie at PELL.NET>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Thursday, December 28, 2000 5:28 PM
Subject: [off topic] distance


> Hi all, off topic question... does anyone already have code for
determining
> Earth surface distance, given latitude and longitude points of two
locations?
>
> Kat
>

new topic     » goto parent     » topic index » view message » categorize

3. Re: [off topic] distance

On 28 Dec 2000, at 22:12, jiri babor wrote:

> Kat,
>
> Since no-one else has moved so far, try the following function. It's
> pretty rough, but it should be reasonably accurate for distances up
> several hundred kilometers. If you want your answer in miles, just
> divide the returned value by 1.609.

Thankyou lots, Jiri. I have not had the chance to test it yet, things keep
happening irl, atm i am without running water or sewer, due to the cold. I
don't have a thermometer, but according to Tiggr:

Currently, as reported at Birmingham, AL.: Last updated Sunday,
December 31, at 2:57 AM Central Standard Time ( 3:57 AM EST) : Fair
Temp: 19F/-7C ; Wind Chill: 13F/-10C

What i am doing atm is getting latitude/longitude of places around the
world. So far i have 800Megabytes, about 6 million named places. If
nothing else, this will pretty much assure me that Tiggr will have a place
listed for anywhere one would want the weather, as well as distances
between them, and possibly be able to give realistic mileages between
places. I figure mileage can be given from airport hubs or major population
centers, if nothing else. In addition, Tiggr has the religions, languages,
populations, gross national product, industry stats, etc for countries.
Here's hoping the info can be useful !

Kat

new topic     » goto parent     » topic index » view message » categorize

4. Re: [off topic] distance

------=_NextPart_000_0007_01C07310.B6695040
        charset="iso-8859-1"

Kat wrote:

> Hi all, off topic question... does anyone already have code for
determining
> Earth surface distance, given latitude and longitude points of two
locations?

Jiri's code is a good approximation for short distances.  For longer
distances, you should use the Great Circle method.  The attached note gives
a brief description and the formula.  Just be sure to convert degrees to
radians.

-- Colin


------=_NextPart_000_0007_01C07310.B6695040
        name="gt_circ.txt"
Content-Transfer-Encoding: quoted-printable

new topic     » goto parent     » topic index » view message » categorize

5. Re: [off topic] distance

Thanks, Colin. I did not know the English name of the method, so I
could not find it, and I was not brave enough (or perhaps too lazy) to
derive it all again myself. I resorted to a shortcut, hoping Kat was
interested in only relatively short distances. But she has already
revealed her global ambitions, so she really would be better off with
the Great Circle Method (I must remember that too, since it's most
unlikely to crop up in my life time again! ;)).

Have nice millennium. jiri


----- Original Message -----
From: "Colin Taylor" <cetaylor at COMPUSERVE.COM>
To: <EUPHORIA at LISTSERV.MUOHIO.EDU>
Sent: Monday, January 01, 2001 5:01 AM
Subject: Re: [off topic] distance


> Kat wrote:
>
> > Hi all, off topic question... does anyone already have code for
> determining
> > Earth surface distance, given latitude and longitude points of two
> locations?
>
> Jiri's code is a good approximation for short distances.  For longer
> distances, you should use the Great Circle method.  The attached
note gives
> a brief description and the formula.  Just be sure to convert
degrees to
> radians.
>
> -- Colin
>
>

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu