3 ms·
You can trade some accuracy for speed by calculating the straight-line distance and then increasing it by some factor to account for turns and detours. Convert
by byoung2 16y ago
You can trade some accuracy for speed by calculating the straight-line distance and then increasing it by some factor to account for turns and detours. Converting zip codes to latitude/longitude is a trivial process if you have a database (e.g. MaxMind) or API (e.g. SimpleGeo). You can calculate straight-line distance between two lat/lon pairs pretty easily (http://jan.ucc.nau.edu/~cvm/latlon_formula.html http://jan.ucc.nau.edu/~cvm/latlon_formula.html), and then pad this number to account for geography (e.g. 20 miles as the crow flies is ~27 miles driving).
If you can sacrifice even more accuracy, you can use 50-70 miles per degree latitude/longitude and just find results within a certain range of a given lat/lon pair.