Ask a Question related to Coldfusion - Advanced Techniques, Design and Development.
-
flasheister #1
zip code trig, radius calculations
i have the code below to find the distance between two zips....but i want to
find all the zips around another in a given distance (say 10 miles around
10015), anyone know how to calc?
this is code to find the distance between two zipcodes (you must have a
database of long and lats for each zipcode)
<cfset radlat1 = ((pi() * lat1)/180)>
<cfset radlat2 = ((pi() * lat2)/180)>
<cfset radlon1 = ((pi() * lon1)/180)>
<cfset radlon2 = ((pi() * lon2)/180)>
<cfset theta = lon1-lon2>
<cfset radtheta = ((pi() * theta)/180)>
<cfset dist = ((60 * 1.1515) * (180 / pi()) * (ACos((Sin(radlat1) *
Sin(radlat2)) + (Cos(radlat1) * Cos(radlat2) * Cos(radtheta)))))>
flasheister Guest
-
How to set PieChart radius?
I have two PieCharts -- one displays a subset of the data shown in the other. Therefore, I'd like the second to be proportionally smaller. How do I... -
Zip code radius query
I found this query in another post and since it appeared to be exactly what i needed, i copied it. thank you to the author. My problem is that... -
Radius authentication
Hi, I need to authenticate against Radius Server from different platforms (windows and unix) . Can you help? thx -
Radius Authentication...
Hey, I have searched and searched and searched for direction with this subject. Basically, I would like to use our local Windows 20003 IAS Server... -
Radius Server
Has anyone setup a Radius server before using Debian ? Matt -- -
Pat D. #2
Re: zip code trig, radius calculations
Hm. Your code sure looks more likely to be correct than what I used for the
distances. I made some simplifying assumptions that of course go whacky near
the poles but who really cares? ;-> Here's the code I'm using: ------- <cfset
LocalLat = q_GetLocal.Lat> <cfset LocalLong = q_GetLocal.Long> <cfloop
condition='Contacts lt 3'> <cfset Range = Range + 0.5> <cfset LatLow =
LocalLat - Range> <cfset LatHigh = LocalLat + Range> <cfset LongLow =
LocalLong - Range> <cfset LongHigh = LocalLong + Range> <!--- simple
query to just count records ---> <cfquery name=q_Contacts datasource=CPS_u>
select Zip from Contacts where Zip in ( select
Zip_Code from Web..ZipCodes where Lat between (#LatLow#) and (#LatHigh#)
and Long between (#LongLow#) and (#LongHigh#) ) </cfquery>
<cfset Contacts = q_Contacts.RecordCount> </cfloop> ----- Note that I'm
looking to find a minimum number of 'hits' in the loop and Range is set at 0
somewhere above this.
Pat D. Guest
-
DrawQuarter #3
Re: zip code trig, radius calculations
I'm also looking to pull nearby parks based on a zip code entry. Did you find the correct calculations? Also, where did you get the database that you use, if I may ask?
Thanks!
DrawQuarter Guest



Reply With Quote

