Hi, download LatLon.Zip from http://www.geocities.com/mklotz.geo/ MX ----- Original Message ----- From: "Elkin Gonzalez" To: Sent: Monday, September 26, 2005 11:05 AM Subject: GPS Positioning System > I've been looking for the equation for finding the distance between two > cities, given the latitude and longitude of both cities. For example: what > is the formula one would use to find the distance between San Francisco > (N37 37' 00" latitude, W122 22' 00" longitude) and Paris (N48 44' 00" > latitude, E02 23' 00" longitude.) > > > > The equation to implement is: > > A = LAT1, B = LONG1 > C = LAT2, D = LONG2 (all converted to radians: degree/57.29577951) > > IF A = C AND B = D THEN DISTANCE = 0; > ELSE > > IF [SIN(A)SIN(C)+COS(A)COS(C)COS(B-D)] > 1 THEN DISTANCE = > 3963.1*ARCOS[1]; /* solved a prob I ran into. I haven't fully > analyzed it yet */ > ELSE > > DISTANCE=3963.1*ARCOS[SIN(A)SIN(C)+COS(A)COS(C)COS(B-D)]; > > I'm trying to write a program for the 18F452 PIC micro that will > include this distance > calculation in it. > > Any help that members of "The PIC List" can offer would be greatly > appreciated. > > > > Elkin Dario Gonzalez Sierra > Bogota (COLOMBIA) > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist