Distance between locations

G

GRL

Is there an utility to compute the distance between two locations, given the
longitudes and the latitudes of both?
Thanks.
Giovanni
 
H

H.M.A. (Dick) Hazeleger

GRL said:
Is there an utility to compute the distance between two locations,
given the longitudes and the latitudes of both?
Thanks.
Giovanni

Hi Giovanni,

The only program that turned up was "world29", but... it is a DOS
program, and the status (freeware or not) is undetermined... if you can
use it.. type world29 into a google form and you'll get at least 5
links from where it can be downloaded.

If you cannot use it, ask a radio amateur (HAM operator) they use a
system called QRA locators, which is based on the formulas World29
uses... you may then use any simple programming language to write
something that would fit your needs AND can run on your OS.

73 and a Happy New Year!

Dick
 
B

Bill Day

Is there an utility to compute the distance between two locations, given the
longitudes and the latitudes of both?
Thanks.
Giovanni
well, WorldTime, primarily know as a fancy clock synchronization
program, has this as an extra feature. It shows you a map, and lets you
read directly the distance from one of the defined locations (which
means any of many cities world-wide).....
http://www.pawprint.net/wt/

You can't just type in long. and lat., but you move the cursor and read
the distance from the defined location in kilometers, miles, nautical
miles..or inches..*grin*....

it's a nice program, even it is not 'exactly' what you were looking for.
 
S

Sietse Fliege

Bill said:
well, WorldTime, primarily know as a fancy clock synchronization
program, has this as an extra feature. It shows you a map, and lets
you read directly the distance from one of the defined locations
(which means any of many cities world-wide).....
http://www.pawprint.net/wt/

You can't just type in long. and lat., but you move the cursor and
read the distance from the defined location in kilometers, miles,
nautical miles..or inches..*grin*....

it's a nice program, even it is not 'exactly' what you were looking
for.

Equally, Calendar Magic shows you "Great circle" distances between any
two of 7200 locations across the world.
(Choose locations from drop down boxes.)
http://www.stokepoges.plus.com/calendar.htm

There is also this DOS program (works well on my XP), where you can
enter longitudes and the latitudes :
http://www.wcrl.ars.usda.gov/cec/moregen.htm
http://www.wcrl.ars.usda.gov/cec/download/earth.exe
 
S

Sascha Wostmann

GRL :
Is there an utility to compute the distance between two locations, given the
longitudes and the latitudes of both?
Thanks.
Giovanni
the formula is as follows:

D = ACos((Sin(LA1)*Sin(LA2)) + (Cos(LA1)*Cos(LA2)*Cos(LO1-LO2))) * r

with:

LA1 / LA2 = latitude position 1 / 2
LO1 / LO2 = longitude 1 / 2
r = radius of earth (~ 6371 km = ~3958,75 miles)
D = distance between locations (in km or miles depending on r)


Source: somewhere below http://geoclassphp.sourceforge.net




Viele Grüße,
Sascha
 
C

Cousin Stanley

| D = ACos((Sin(LA1)*Sin(LA2)) + (Cos(LA1)*Cos(LA2)*Cos(LO1-LO2))) * r

Sascha ....

Got Python ????

http://www.python.org

Using the function you posted above,
I wrote a small Python program
to implement it ....

I only tested it with a handful of cities
here in Arizona for which I knew approximate
distances, but the numbers looked OK for those ....

There is no input validation,
so if you put garbage in,
you will get garbage out ....

--
Cousin Stanley
Human Being
Phoenix, Arizona

# ----------------------------------------------------------------------

'''
Module ..... gcircle.py

Purpose .... Compute great circle distance
between two points on earth
specified by the latitude and longitude
of each point

Usage ...... python gcircle.py

When prompted, enter Latitudes and Longitudes
as real numbers in degrees.

Enter .... q or quit to exit

Enter .... ? or help to display this usage info

Code_By ...... Stanley C. Kitching

Code_Date .... 2003-12-28

Thanks_To .... Sascha Wostmann

For posting the mathematical function
for computing great circle distance
to the NewsGroup alt.comp.freeware
'''

import math
import sys

print
print ' ' , sys.argv[ 0 ]
print
print ' Greetings, huMahn .... :) '
print

def adios() :

print
print ' Adios, huMahn .... '
print

sys.exit( 0 )


def input_get( prompt ) :

check_out = [ '' , 'q' , 'quit' , 'Q' , 'Quit' ]

this_string = raw_input( ' Enter %s .... ' % prompt )

if this_string in check_out :

adios()

if this_string == '?' or this_string == 'help' :

print
print __doc__

adios()

return float( this_string )


def deg2rad( degrees ) :

radians = degrees * ( math.pi / 180.0 )

return radians


def distance( La1 , Lo1 , La2 , Lo2 ) :

r = 3958.75 # radius of earth in miles

sines = math.sin( La1 ) * math.sin( La2 )
cosines = math.cos( La1 ) * math.cos( La2 ) * math.cos( Lo1 - Lo2 )

dist = math.acos( sines + cosines ) * r

return dist


list_prompts = [ 'Latitude 1' ,
'Longitude 1' ,
'Latitude 2' ,
'Longitude 2' ]

# Get User Input and convert degrees to radians

list_angles = []

for this_prompt in list_prompts :

this_angle = deg2rad( input_get( this_prompt ) )

list_angles.append( this_angle )


# Give each of the angles from the list a name
# and compute the distance between the two points

la1 = list_angles[ 0 ] # Latitude 1
lo1 = list_angles[ 1 ] # Longitude 1

la2 = list_angles[ 2 ] # Latitude 2
lo2 = list_angles[ 3 ] # Longitude 2

dist_miles = distance( la1 , lo1 , la2 , lo2 )

dist_km = dist_miles * 1.609344

print
print ' Distance .... %8.2f Miles' % dist_miles
print
print ' %8.2f Kilometers' % dist_km
 
B

Bill Day

Equally, Calendar Magic shows you "Great circle" distances between any
two of 7200 locations across the world.
(Choose locations from drop down boxes.)
http://www.stokepoges.plus.com/calendar.htm

There is also this DOS program (works well on my XP), where you can
enter longitudes and the latitudes :
http://www.wcrl.ars.usda.gov/cec/moregen.htm
http://www.wcrl.ars.usda.gov/cec/download/earth.exe

I KNEW that sounded familar...I have had Calendar Magic installed for
ages, but don't think I have ever used it.....I got it for all the
exotic date comparisons to show a friend who is Jewish. I just need to
put the icon somewhere that it will remind me.

I still like the graphic aspect of WorldTime for basic visualization of
distances, but thanks for reminding me/us.
 
P

prude

D = ACos((Sin(LA1)*Sin(LA2)) + (Cos(LA1)*Cos(LA2)*Cos(LO1-LO2))) * r

Alternatively, set it up as a formula in Exel. Or if you want a free
program in 602Tab which is part of the 602PC Suite at
http://www.602software.com
 
D

dszady

Is there an utility to compute the distance between two locations, given the
longitudes and the latitudes of both?
Thanks.
Giovanni

Back again. Try this:
Geocalc 4.20 Freeware (no Screenshots) 2,121,216b
Home Page: http://www.geocomp.com.au/geocalc/index.htm
D/L: http://www.geocomp.com.au/geocalc/gcalc420.exe (fast d/l)

http://software.geocomm.com/coorconv/
D/L: ftp://download1.geocomm.com/sd2/GEOCALC420.EXE Zip/EXE (slow
d/l}
or
GeoCalc 4.20 is a 32-bit Windows application that uses seven-parameter
transformations to convert ASCII coordinate data files between mapping
systems. Pick from the extensive list or define your own. GeoCalc is
distributed free of charge.
HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top