Ok, I am retarded. Each I find asks for 2 longitudes and 2
latitudes. What
am I missing. I can grab the longtitude and latitude from the
user's zip
code from the database of zipcodes I have. I can ask for the
max distance
(25 miles, 50 miles, etc.) But then I need to plug those
values into a
formula to generate a range of zipcodes that fall within,
right?
I found this while searching for the formula:
What is my second long and lat when I am supplying the first
long and lat
and distance from the user's information.
<!---UDF distance Formula||--->
<CFSCRIPT>
//calculate the Deltas
function distance(lat1,lat2,lon1,lon2)
{ km=6367;
deltaLon=twoRadians(lon1)-twoRadians(lon2);
deltaLat=twoRadians(lat1)-twoRadians(lat2);
//intermediate values
intMedVal = sin2(deltaLat/2) + cos(twoRadians(lat1)) *
cos(twoRadians(lat2)) * sin2(deltaLon/2);
//the great circle distance in radians gcd = 2 *
arcSin(getMin(1,Sqr(intMedVal)));
//multiply the the radians by the radius to get the distance
in specified
units d = km * gcd;
//this only applies to us (ANDRONICS.CO.UK)
//it relevant to the vendor that is displaying the map data
//the map is coming back in rectangular format they use the
length as the
zoom distance
//we multiply it by 2 two get an equal zoom distance from top
to bottom
d = round(d * 2); }
//Convert to Radians
function twoRadians(currDegree){
(currDegree * (Pi()/180));
}
function sin2(currVal){
(1 - cos(2*currVal))/2;
} function arcSin(x){
atn(x/Sqr(-x * x + 1));
} function getMin(y,z)
{ if(y lte z){ getMin=y;
}else{
getMin=z;
}
}
</CFSCRIPT>
<CFSET
ATTRIBUTES.D=distance(maxLatitude,minLatitude,maxLongitude,minLongitude)>
I appreciate the help and the patients. This one really
confuses me... 🙂