Re: Zip Code proximity search

2001-11-19 Thread Tom Bradford
Benjamin Pflugmann wrote: > > Hi. > > On Wed, Nov 14, 2001 at 10:02:54AM -0500, [EMAIL PROTECTED] wrote: > > Currently, I am using the following query: > > > > SELECT DISTINCT o.szZipCode FROM tblZips z,tblZips o WHERE > > z.szZipCode=$szZip AND (3956 * (2 * > > ASIN(SQRT(POWER(SIN(((z.dblLat-o.

Re: Zip Code proximity search

2001-11-19 Thread Benjamin Pflugmann
Hi. On Wed, Nov 14, 2001 at 10:02:54AM -0500, [EMAIL PROTECTED] wrote: > Currently, I am using the following query: > > SELECT DISTINCT o.szZipCode FROM tblZips z,tblZips o WHERE > z.szZipCode=$szZip AND (3956 * (2 * > ASIN(SQRT(POWER(SIN(((z.dblLat-o.dblLat)*0.017453293)/2),2) + > COS(z.dblLat*

Re: Zip Code proximity search

2001-11-14 Thread Carl Troein
Adam Nelson writes: > [...] POWER(SIN(((z.dblLon-o.dblLon)*0.017453293)/2),2) < $iRadius > > This runs rather slowly over the 76 thousand zip codes in the US. > > 2) Compute the max/min latitude/longitude and then query on that range > (proximity becomes a square, but that's not a big deal

Zip Code proximity search

2001-11-14 Thread Adam Nelson
Currently, I am using the following query: SELECT DISTINCT o.szZipCode FROM tblZips z,tblZips o WHERE z.szZipCode=$szZip AND (3956 * (2 * ASIN(SQRT(POWER(SIN(((z.dblLat-o.dblLat)*0.017453293)/2),2) + COS(z.dblLat*0.017453293) * COS(o.dblLat*0.017453293) * POWER(SIN(((z.dblLon-o.dblLon)*0.01745329