Guest Markwell Posted June 6, 2001 Share Posted June 6, 2001 I've asked "Dr. Math", I've asked Jeremy (but I know he's far too busy), so I'll post this out for the Math Professors in the forum. I have my own little Microsoft Access database on which I keep Cache info for local caches and others I plan on visiting. I'm trying to make it as robust as possible for my own use.I've even got a little side query that calculates the decimal degree version of the coordinates. I've also got a table of fixed landmarks (interstate intersections, airports, my house, etc.) that I have decimal versions of the coordinates as well. What I'm looking for is a wholistic formula or visual basic add-in for Access that takes the degree coordinates and gives me a resulting degree bearing. Example: moving from N41° W88° to N42° W87° you have an initial bearing of roughly 36.5° (I've got an add-in for Excel, but not Access). I have the formulas for calculating the distance in Radians, KM and miles (boy is THAT long), but I'm still looking for the formula to do the bearing. Any ideas? Any sources? Markwell MarkLent60544@aol.com Quote Link to comment
Guest ClayJar Posted June 6, 2001 Share Posted June 6, 2001 I have no answers, but you'd need to take into account the curvature of the earth to get a true point-to-point result, right? (That's where my two-second overview skills stop and my "Do I want to spend a few hours doing the derivations?" skills kick in.) Quote Link to comment
Guest Markwell Posted June 6, 2001 Share Posted June 6, 2001 les: (Atn(-(Cos([FixedLat]*PI/180)*Cos([CacheLat]*PI/180) *Cos(([CacheLong]-[FixedLong])*PI/180) +Sin([FixedLat]*PI/180)*Sin([CacheLat]*PI/180)) /Sqr(-(Cos([FixedLat]*PI/180) *Cos([CacheLat]*PI/180) *Cos(([CacheLong]-[FixedLong])*PI/180) +Sin([FixedLat]*PI/180)*Sin([CacheLat]*PI/180)) *(Cos([FixedLat]*PI/180)*Cos([CacheLat]*PI/180) *Cos(([CacheLong]-[FixedLong])*PI/180) +Sin([FixedLat]*PI/180)*Sin([CacheLat]*PI/180))+1)) +2*Atn(1))*3959 And that's just the distance Quote Link to comment
Guest Markwell Posted June 6, 2001 Share Posted June 6, 2001 les: (Atn(-(Cos([FixedLat]*PI/180)*Cos([CacheLat]*PI/180) *Cos(([CacheLong]-[FixedLong])*PI/180) +Sin([FixedLat]*PI/180)*Sin([CacheLat]*PI/180)) /Sqr(-(Cos([FixedLat]*PI/180) *Cos([CacheLat]*PI/180) *Cos(([CacheLong]-[FixedLong])*PI/180) +Sin([FixedLat]*PI/180)*Sin([CacheLat]*PI/180)) *(Cos([FixedLat]*PI/180)*Cos([CacheLat]*PI/180) *Cos(([CacheLong]-[FixedLong])*PI/180) +Sin([FixedLat]*PI/180)*Sin([CacheLat]*PI/180))+1)) +2*Atn(1))*3959 And that's just the distance Quote Link to comment
Guest bob_renner Posted June 6, 2001 Share Posted June 6, 2001 What you're wanting to do is calculate the great circle distance and initial heading of that great circle. See this site for equations: http://www.best.com/~williams/avform.htm Bob Quote Link to comment
Guest Markwell Posted June 6, 2001 Share Posted June 6, 2001 quote:From website:An alternative formula, not requiring the pre-computation of d, the distance between the points, is: tc1=mod(atan2(sin(lon1-lon2)*cos(lat2), cos(lat1)*sin(lat2)-sin(lat1)*cos(lat2) *cos(lon1-lon2)), 2*pi) First the equation above this one inserts the variable "d" as distance - I'm having a problem with that - is that distance in Radians? I also have to convert the formulas to some simpler terms as not all trig functions are available in Access like they are in Excel. So, Mod() and atan2() are foreign to me. Whenever I tried to use this formula (and I have) I've gotten a lot of "Error#" results. Again, I think I've exhausted the internet resources - including "Dr. Math" where a live human tried to answer my questions. I may have to call up my old trig professor. I'd be MORE than willing to e-mail my tried and failed formula to a mathematician to have him proof it. EEEEK! Quote Link to comment
Guest JIntorcio Posted June 7, 2001 Share Posted June 7, 2001 You might be able to eliminate the two offending functions. Mod is sure for Modulo. It means ?remainder?. Mod(X,2ð) means the remainder when X is divided by 2ð. You can fake this b recursively subtracting 2ð until the resulting value is less than 2ð. Atan2 is just another form of atan or arctangent that doesn?t explode at the ð/2 and - ð/2 points. It may be that, if Access has an arctangent function, it handles those cases or, it may be that the won?t really happen in your case so you don?t care? Try faking the Mod and using the built in atan and see what you get! ------------------ >>> John <<< Quote Link to comment
Guest Markwell Posted June 7, 2001 Share Posted June 7, 2001 Thanks John and everybody else, I got it. It ain't pretty, and Access has to churn away quite a while, but it's pretty cool. I would be remiss if I didn't publically thank Dr. Math, the Mathematical Equivalent of Ask Jeeves. I can now see the cache on a screen and see in a list the fixed known locations from the closest to the farthest and the bearing the cache is from the fixed location. I can also do a radial search, say on "O'Hare Aiport" and find not only the distance but the bearing in degrees (and consequestly an approximate direction) - and list the caches from the closest out. Any other Access geek out there that wants further information can contact me at MarkLent60544@aol.com Markwell Quote Link to comment
Guest Cape Cod Cache Posted June 7, 2001 Share Posted June 7, 2001 For some heavy duty cartography, hit the National Image and Mapping Agency http://www.nima.mil/ It's rather interesting, you paid for it, use it ... They are trying to get USGS to smarten up and use WGS 84 for one thing, and have a major database of all maps/chart be uniform. Math stuff I care not to think about as well, I don't sleep well as it is . Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.