[thelist] determine radius of zips
Will Lynch
wlynch at powerprinting.net
Mon Mar 15 15:15:03 CST 2004
Although not perfect and I still have problems with it.. This is a close
to anything I have found to work so far. I wish I could have found a
'canned' snippet for this..its been difficult to say the least.
SET SAFETY OFF
SELECT automaster
locate for ZENTER3.Czip = '45403'
store latitude to lat
store longitude to long
STORE SUBSTR(ZIP,1,5) TO MZIP
SELECT passedzip
REPLACE LATITUDE WITH LAT
REPLACE LONGITUDE WITH LONG
replace zip with MZIP
passedradius = val(DIST.DIST)
SELECT zip,city,st,longitude,latitude,
ROUND((ACOS((SIN(val(passedzip.latitude)/57.2958) *
SIN(val(passedzip.latitude)/57.2958)) +
(COS(val(passedzip.latitude)/57.2958) *
COS(val(passedzip.latitude)/57.2958) *
COS(val(passedzip.longitude)/57.2958 -
val(passedzip.longitude)/57.2958)))) * 3963,3)^2;
AS distance;
FROM automaster;
WHERE (val(latitude) >= val(passedzip.latitude) -
(passedradius/111));
And (val(latitude) <= val(passedzip.latitude) + (passedradius/111));
AND (val(longitude) >= val(passedzip.longitude) -
(passedradius/111));
AND (val(longitude) <= val(passedzip.longitude) +
(passedradius/111));
group by zip;
ORDER BY zip
clear
thisform.refresh
For unsubscribe and other options, including the Tip Harvester
and archives of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !
More information about the thelist
mailing list