[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference vicki::boats

Title:Powerboats
Notice:Introductions 2 /Classifieds 3 / '97 Ski Season 1267
Moderator:KWLITY::SUTER
Created:Thu May 12 1988
Last Modified:Wed Jun 04 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:1275
Total number of notes:18109

1031.0. "need formula to calc distance from latitude longitude" by BLUEFN::GORDON () Tue Dec 15 1992 10:46

I have a friend who is writing a program which need to calculate distances from
point to point.  I suggested that he use latitude and longitude.  After looking
into my Chapman;s manual I was supprised to find that there in no formula in there
to do what calc this.  Everything in there assumes that you have a chart to
look at.

Does anyone know how to do this?  I guess the loran has really spoiled us.

Thanks for your help.

Gordon  (only 5 months to splash down)
T.RTitleUserPersonal
Name
DateLines
1031.1...SPARKL::JOHNHCTue Dec 15 1992 19:4416
    Uh, did you remember when you suggested lattitude and longitude that
    the world is more or less round?
    
    The little "squares" made by the intersections get bigger as you
    approach the equator and smaller as you approach the poles.
    
    Sure, there's a  formula for it somewhere, but don't you think there's
    probably a simpler method?
    
    FWIW
    
    John H-C
    
    P.S. The formula would only be for approximations, anyway, since the
    globe is not really a globe (in geometric terms).
        
1031.2Dutton's Navigation & PilotingWBC::RODENHISERTue Dec 15 1992 21:0813
    Presuming that your friend already has factored the shape of the earth
    into the equation, the place to look is: Dutton's Navigation & Piloting
    by Elbert S. Maloney.
    
    Reference the chapter on "The Sailings" which is the term used to refer
    collectively to various mathematical methods of solving problems
    involving course, distance, difference of latitude, difference of 
    longitude, and departure.
    
    Dutton also refers the reader to Bowditch for a more detailed
    discussion of the derivations of these equations.
    
    JR
1031.3Small scale navigationKLAATU::HOBBSWed Dec 16 1992 06:506
	For ploting and simple navigation on a chart (flat surface, or
Mercator [sp?] projection) a simple rule of thumb is Lat is a mile per
minute of arc; and Lon is a mile per minute times the cos of Lat.
	Hope this helps on the small scale.

	Rick
1031.4in FORTRAN .....UNIFIX::BERENSAlan BerensWed Dec 16 1992 09:14113
There are a number of standard spherical trigonometry equations and
methods to calculate the distance between two locations specified by
their latitude and longitude. These are given in almost all celestial
navigation textbooks and in Bowditch. If you understand FORTRAN, read 
on. The equations assume a perfectly spherical earth, which is good 
enough for most purposes. The difference between the great circle 
distance and the distance from a Mercator chart is small for locations 
close together. For locations far apart, the difference is significant, 
which is why ships and aircraft on long passages follow great circle 
routes.

Alan

================================================================================
             <<< UNIFIX::$1$DUA14:[NOTES$LIBRARY]SAILING.NOTE;1 >>>
                                  -< SAILING >-
================================================================================
Note 513.1                   Distance from Lat/Long                       1 of 5
PULSAR::BERENS "Alan Berens"                         92 lines  24-MAR-1987 17:28
                           -< an answer in FORTRAN >-
--------------------------------------------------------------------------------
C	GCIRCLE: Great Circle Navigation        January 1982
C
C	This program calculates the great circle distance between
C	a place of departure and a destination. It also calculates
C	the initial course for sailing the great circle. It is based
C	on the method and equations in Budlong.
C
	REAL*8 DEG,DIST,HC,LAT,LATD,LONG,LONGD,M,MA,MIN,PI,X,Y,Z
C
	TYPE 5
 5	FORMAT (1X)
C
C       Enter departure latitude in degrees and minutes
C
 30	TYPE 95
 95	FORMAT (1X,'DEPARTURE LATITUDE         ',$)
	ACCEPT *, DEG, MIN
	LAT=DEG+MIN/60.0D00
C
C       Enter departure longitude (assumed west) in degrees and minutes
C
	TYPE 90
 90	FORMAT (1X,'DEPARTURE LONGITUDE        ',$)
	ACCEPT *, DEG, MIN
	LONG=DEG+MIN/60.0D00
	TYPE 5
C
C       Enter destination latitude in degrees and minutes
C
	TYPE 10
 10	FORMAT (1X,'DESTINATION LATITUDE       ',$)
	ACCEPT *, DEG, MIN
	LATD=DEG+MIN/60.0D00
C
C	Enter destination longitude in degrees and minutes
C
	TYPE 20
 20	FORMAT (1X,'DESTINATION LONGITUDE      ',$)
	ACCEPT *, DEG, MIN
	LONGD=DEG+MIN/60.0D00
	TYPE 5
C
C	Find meridian angle (MA)
C	If (MA .LE. 0) then course between 0 and 180
C
	MA=LONG-LONGD
C
C	Convert degrees to radians
C
	PI=3.141592653589793D00
	LAT=LAT*PI/180.0D00
	LATD=LATD*PI/180.0D00
	M=MA*PI/180.0D00
C
C	Hc computation
C
	X=SIN(LAT)*SIN(LATD)
	Y=COS(LAT)*COS(LATD)*COS(M)
	HC=ASIN(X+Y)
C
C	Great circle distance computation
C
	HC=HC*180.0D00/PI
	DIST=(90.0D00-HC)*60.0D00
C
C	Z computation
C
	X=COS(LAT)*TAN(LATD)
	Y=SIN(LAT)*COS(M)
	Z=ATAN(SIN(M)/(X-Y))
	Z=Z*180.0D00/PI
C
C	Determine actual course -- necessary because of 
C	implementation of ATAN
C
	IF (MA .EQ. 0.0 .AND. LATD .GT. LAT) Z=0.0D00
	IF (MA .EQ. 0.0 .AND. LATD .LT. LAT) Z=180.0D00
	IF (MA .GT. 0.0 .AND. Z .GE. 0.0) Z=Z
	IF (MA .GT. 0.0 .AND. Z .LT. 0.0) Z=Z+180.0D00
	IF (MA .LT. 0.0 .AND. Z .GE. 0.0) Z=Z+180.0D00
	IF (MA .LT. 0.0 .AND. Z .LT. 0.0) Z=Z+360.0D00
C
C	Results
C
	TYPE *, 'DISTANCE   ',DIST,'NM'
	TYPE *, 'COURSE     ',Z,'DEGREES'
	TYPE 5
	TYPE 5
	TYPE 5
	GOTO 30
	END

1031.5ThanksBLUEFN::GORDONThu Dec 17 1992 11:5710
Thanks the Fortran program was exactly what I was looking for.  I knew that
someone out there had done this before.

I was trying to figure out how to do this and I now realize how spoiled I am
having a loran.  Maybe I'll spend some time this winter brushing up on basic
navagation techniques in case the loran goes down somewhere between here and
there.  


Gordon