I have a query that gets the lat and long for a zip. I then pass that
to another query that finds zip codes within a range. The problem is
that some zip codes you search for don't show but others do. Ugh!
I don't even know where to start looking to fix the problem. Any
suggestion? Is there better math to use?
Here is a sample of my sql.
SELECT
lat,
long,
name,
city,
state,
zipcode,
3963 * (ACOS((SIN(#passedzip.lat#/57.2958) * SIN(lat/57.2958)) +
(COS(#passedzip.lat#/57.2958) * COS(lat/57.2958) *
COS(long/57.2958 - #passedzip.long#/57.2958)))) AS distance
FROM
dealers_geo
WHERE
3963 * (ACOS((SIN(#passedzip.lat#/57.2958) * SIN(lat/57.2958)) +
(COS(#passedzip.lat#/57.2958) * COS(lat/57.2958) *
COS(long/57.2958 - #passedzip.long#/57.2958)))) <=
#attributes.passedradius#
ORDER BY
distance
--
Phillip B.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:6:2095
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/6
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:6
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.6
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54