Thanks Will. Can you tell if the formula that you used to calculate the distance between 2 latitutdes and longitudes is the "flat-earth" formula or the "spherical earth" formula? I am talking about: ROUND((ACOS((SIN(#passedzip.latitude#/57.2958) * SIN(latitude/57.2958)) + (COS(#passedzip.latitude#/57.2958) * COS(latitude/57.2958) * COS(longitude/57.2958 - #passedzip.longitude#/57.2958)))) * 3963)
Thanks again, K On 12/2/05, Will Tomlinson <[EMAIL PROTECTED]> wrote: > > First, I get all the long/lat info from the zip table with a query named > passedzip. No cfqueryparams here so don't say anything bout it. And I did > this two years ago before I got decent. lol > > SELECT * FROM tblzipcodes > WHERE zipcode=#FORM.passedzipcode# > > This runs the query to display the items found within the passed radius > from the form. Just drop out all the crap fields. > > SELECT tblChorusGroups.ChorusID, tblChorusGroups.ChorusName, > tblChorusGroups.ChorusCity, tblChorusGroups.ChorusState, > tblChorusGroups.ChorusZip, tblChorusTypes.ChorusTypeCategory, > tblChorusTypes.ChorusID, tblzipcodes.zipcode, tblzipcodes.longitude, > tblzipcodes.latitude, > ROUND((ACOS((SIN(#passedzip.latitude#/57.2958) * SIN(latitude/57.2958)) + > (COS(#passedzip.latitude#/57.2958) * COS(latitude/57.2958) * > COS(longitude/57.2958 - #passedzip.longitude#/57.2958)))) > * 3963) AS distance > FROM tblChorusGroups, tblChorusTypes, tblzipcodes > WHERE tblChorusGroups.ChorusID = tblChorusTypes.ChorusID > AND tblChorusGroups.ChorusZip = tblzipcodes.zipcode > AND (latitude >= #passedzip.latitude# - (#FORM.passedradius#/111)) > AND (latitude <= #passedzip.latitude# + (#FORM.passedradius#/111)) > AND (longitude >= #passedzip.longitude# - (#FORM.passedradius#/111)) > AND (longitude <= #passedzip.longitude# + (#FORM.passedradius#/111)) > <cfif IsDefined("grouptype") AND #FORM.grouptype# NEQ ""> > AND tblChorusGroups.ChorusGroupType = '#FORM.grouptype#'</cfif> > <cfif IsDefined("groupcategory") AND #FORM.groupcategory# NEQ ""> > AND tblChorusTypes.ChorusTypeCategory = '#FORM.groupcategory#'</cfif> > GROUP BY tblChorusGroups.ChorusName > ORDER BY distance > > > Will > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:225997 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54