![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm using the formula below to calculate the distance between 2 zipcodes. It is fairly accurate most of the time but occasionally mis-calculates (ie 35 miles between 31901 Columbus, GA and 30303 Atlanta,GA). Does anyone have a better/more reliable formula? 3959*Atan( (1- (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(E ndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))^2)^.5 / (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(E ndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))) |
#3
| |||
| |||
|
|
I'm using the formula below to calculate the distance between 2 zipcodes. It is fairly accurate most of the time but occasionally mis-calculates (ie 35 miles between 31901 Columbus, GA and 30303 Atlanta,GA). Does anyone have a better/more reliable formula? 3959*Atan( (1- (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(EndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))^2)^.5 / (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(EndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))) |
#4
| |||
| |||
|
|
I'm using the formula below to calculate the distance between 2 zipcodes. It is fairly accurate most of the time but occasionally mis-calculates (ie 35 miles between 31901 Columbus, GA and 30303 Atlanta,GA). Does anyone have a better/more reliable formula? 3959*Atan( (1- (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(EndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))^2)^.5 / (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(EndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))) |
#5
| |||
| |||
|
|
Many thanks to Tom and Howard. I anticipate moving to 8.5 but for now am using version 6 pro. Howard you mentioned some tweaks and workarounds for version 6. Can you provide more insight there? Is it a matter of factoring the long/lat so that most of the math is performed on integers instead of decimals then reversing the factor afterward? Tom I tried the wikipedia link and the formula that appeared least prone to rounding errors (the third one which uses arctan, arcsin and arccos are not available in FM6 or 8.5). I cannot get that formula to produce more than a single result. Have rechecked the formula repeatedly to no avail. I'm fairly handy with math but certainly do not profess to be a trig wiz. btw - I created 4 calc fields which use the radians function to convert long/lat to radians. This helped to clean up the original formula. Atan( Sqrt( (Cos(REndLat) * Sin(REndLon - RBegLon) ^2) + (Cos(RBegLat)*Sin(REndLat) - Sin(RBegLat) * Cos(REndLat) * Cos(REndLon - RBegLon)^2) / Sin(RBegLat) * Sin(REndLat) + Cos( RBegLat) * Cos(REndLat) * Cos(REndLon - RBegLon) ) ) "GSP@DCS" <info (AT) dcs (DOT) com> wrote in message news:b7135$453fd847$d1a8fa82$21167 (AT) EDELTACOM (DOT) COM... I'm using the formula below to calculate the distance between 2 zipcodes. It is fairly accurate most of the time but occasionally mis-calculates (ie 35 miles between 31901 Columbus, GA and 30303 Atlanta,GA). Does anyone have a better/more reliable formula? 3959*Atan( (1- (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(EndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))^2)^.5 / (Sin(BeginLongLat::lattitude/57.3248)*Sin(EndLongLat::lattitude/57.3248) +Cos(BeginLongLat::lattitude/57.3248)*Cos(EndLongLat::lattitude/57.3248)*Cos(EndLongLat::longitude/57.3248-BeginLongLat::longitude/57.3248))) |
#6
| |||
| |||
|
|
Well, I'm no math expert, and it was a while ago that I set it up for a client. As I recall, I tried making some slight tweaks on the calc but found that it was more accurate at closer distances but much less accurate at further distances. |
![]() |
| Thread Tools | |
| Display Modes | |
| |