Quote:
Originally Posted by Back In The Saddle
Sounds like a tough problem to solve, Camron. I just looked up my zip code, and it covers ...oh probably 2-3% of the state. My town is near the edge. Utah is kind of unusual in that the majority of the population live within a fairly narrow corridor running north/south through the center of the state. So the state is framed by huge zip code areas. And since I normally only get mileage when traveling to rural schools, that would seem to make the worst case scenario, the norm.
BTW, would it make more sense to calculate mileage once for each assignment and cache it, rather than calc it on the fly?
|
Almost, I wouldn't cache it per assignment but per zipcode-pair (a much smaller number of entries than the number of assignments and faster to reference).
In fact, if I put the time in to do that, I'd probably take it a step farther and get zip+4 locations or actual address locations (Latitude/Longitude of the home/work and game locations) if I could find a usable source for the data.
As it is, I do 6 trig functions, 4 floating point multiplies, and a couple other miscellaneous operations. That mileage function is not heavily used at this point so it is not that big of a issue.