sorry, just noticed this
if searching by zipcode take a form result(zipcode) and run rays yahoo geocode
cfc
<cftry>
<cfscript>
//get geocoding from yahoo
getlocation =
createObject("component","cfc.yahoo.geocoding").geoSearch(location="#zipcode#");
//set lat & lon
theLat = getlocation.latitude;
theLon = getlocation.longitude;
theCity = getlocation.city;
searchResults =
createObject("component","cfc.dealers.dealerfinder").dealersinradius(theLat="#theLat#",theLon="#theLon#");
</cfscript>
<cfcatch type="any">
<cfset theResults = "Sorry #zipcode# does not appear to be a valid
zipcode">
<cfexit method="exittemplate">
</cfcatch>
</cftry>
then the cfc method
<cffunction name="dealersinradius" output="false" access="public"
returntype="query">
<cfargument name="theLat" type="string" required="yes">
<cfargument name="theLon" type="string" required="yes">
<cfscript>
var radius2 = '250';
var qGetlocs = "";
var dist = '';
var lat_A = theLat;
var lon_A = theLon;
</cfscript>
<cfquery name="qGetlocs" datasource="#request.datasource#">
SELECT *,
ROUND((ACOS((SIN(#lat_A#/57.2958) *
SIN(tbl_latitude/57.2958)) +
(COS(#lat_A#/57.2958) * COS(tbl_latitude/57.2958) *
COS(tbl_longitude/57.2958 - #lon_A#/57.2958))))
* 3963) AS distance
FROM dealers
WHERE (tbl_latitude >= #lat_A# - (#radius2#/111))
And (tbl_latitude <= #lat_A# + (#radius2#/111))
AND (tbl_longitude >= #lon_A# - (#radius2#/111))
AND (tbl_longitude <= #lon_A# + (#radius2#/111))
ORDER BY distance
</cfquery>
<cfreturn qGetlocs />
</cffunction>
> Hi Dave,
>
> Could you please share your Address to lat long code with me?
> [EMAIL PROTECTED]
>
> I've been doing GeoCoding based off zipcodes using a Yahoo web service
> but your method sounds dead on. I set a validition table thats indexed
> where if I dont find a zipcode in my vlaidation table I use the
> webservice to keep up up-to-date.
>
> -Jim
>
> >
> > Email me off-list if u need some code
> >
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Download the latest ColdFusion 8 utilities including Report Builder,
plug-ins for Eclipse and Dreamweaver updates.
http;//www.adobe.com/cfusion/entitlement/index.cfm?e=labs%5adobecf8%5Fbeta
Archive:
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:293981
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4