Sophek,
 
I'd really appreciate getting the scripts, too. Thanks for sharing your hard
work on this.
 
Loyd Campbell
[EMAIL PROTECTED]
 
  _____  

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Sophek Tounn
Sent: Wednesday, April 18, 2007 5:31 PM
To: Dallas/Fort Worth ColdFusion User Group Mailing List
Subject: [DFW CFUG] free Zipcode radius cfc and includes the sql script for
the zipcodeinsertion.
 
Hi All,

I just created a zipradius component that I would like to share, if any one
is interested. I was tasked to develop code to query records within a radius
of a zip code. I figure this can be useful to someone. I make use of Rob
Gonda SQL component for record selection. 

Check this out.

<cfcomponent extends="sql">
    <cffunction name="zipRadius" returntype="query">
        <cfargument name="zip" required="Yes" type="numeric"> 
        <cfargument name="radius" required="Yes" type="numeric">
        <cfset getData =
tblselect("zipcodes","zipcode,latitude,longitude","zipcode =
#arguments.zip#","","","1")> 
        <cfset getDataZip = tblselect("zipcodes","zipcode, latitude,
longitude, statename, city, 3963 * (ACOS((SIN(#getData.latitude#/57.2958) *
SIN(latitude/57.2958)) +(COS(#getData.latitude#/57.2958) *
COS(latitude/57.2958) *COS(longitude/57.2958 -
#getData.longitude#/57.2958)))) AS distance","3963 *
(ACOS((SIN(#getData.latitude#/57.2958) * SIN(latitude/57.2958)) +
(COS(#getData.latitude#/57.2958) * COS(latitude/57.2958) *
COS(longitude/57.2958 - #getData.longitude#/57.2958)))) <=
#arguments.radius#","","","")> 
        <cfreturn getDataZip>
    </cffunction>
</cfcomponent>

Email me if you want the scripts.

Thanks
Sophek
_______________________________________________
Reply to DFWCFUG: 
  [email protected]
Subscribe/Unsubscribe: 
  http://lists1.safesecureweb.com/mailman/listinfo/list
List Archives: 
    http://www.mail-archive.com/list%40list.dfwcfug.org/             
  http://www.mail-archive.com/list%40dfwcfug.org/
DFWCFUG Sponsors: 
  www.instantspot.com/
  www.teksystems.com/

Reply via email to