On Thu, 2003-06-12 at 09:29, Dennis Allison wrote:You proably should use a spherical earth model to compute distances.Depending on your accuracy requirements. The way I read the original post, the goal was to constrain search results to within some number of miles from a given zip code. If that's being used for figuring out how much fuel to put on an airplane, you're going to want far more accurate figures. :-) But if the purpose of this is to get some proxy for driving distance, there's no compelling reason to be any more accurate than within a mile or so... distance "as the crow flies" is only a bare approximation of driving distance anyway.Database search with a "distance from" key is difficult and requires specialized mechanisms.Depending, again, on how good the results need to be. Assuming your *best* search would be defined by point p and some radius r, you could get results *almost* as good by searching for points bounded by p +/- r. A select consisting of two simple range criteria is pretty easy to set up and virtually indistinguishable from *correct* results in a decent range of probable applications. Of course, you *could* use that method as a first pass before performing more expensive computation on the results. But just this one pass might be enough to know what things are *about* X miles from some point. You won't win any comp sci awards for this process, but it's a pragmatic solution that's good enough for many cases. Your mileage may vary. :-) FWIW, Dylan