Greetings,

This is an old question brought to the front again by myself,
there is a similar query to this on the FAQ's finding the distance between
two zip codes,

I have been using a formula similar to this to work out the difference
between longitudes and latitudes

this is what I have been doing,

<!---i GET THE CURRENT LAT AND LONS OF ALL VEHICLE POSITIONS AND PUT THEM IN
AN ARRAY||--->
<!---THEN RUN THE MIN MAX FUNCTIONS||--->
<!---get min max Lon and Lat||--->
<CFSET maxLatitude=arrayMax(latAy)>
<CFSET minLatitude=arrayMin(latAy)>
<CFSET maxLongitude=arrayMax(longAy)>
<CFSET minLongitude=arrayMin(longAy)>

<!---get the center point between all four points||--->
<CFSET latMidPoint=(maxLatitude-minLatitude)>
<CFSET latMidPoint=(ATTRIBUTES.latMidPoint/2)>
<CFSET latMidPoint=(ATTRIBUTES.latMidPoint+minLatitude)>

<CFSET lonMidPoint=(maxLongitude-minLongitude)>
<CFSET lonMidPoint=(ATTRIBUTES.lonMidPoint/2)>
<CFSET lonMidPoint=(ATTRIBUTES.lonMidPoint+minLongitude)> 

<!---The Formula||--->
<!---get the distance between the greatest points||--->
<CFSET
D=(1.852*60)*(ACOS(SIN(minLatitude)*(SIN(maxLatitude)+(COS(minLatitude)*(COS
(maxLatitude)*(COS(minLongitude-maxLongitude)))))))>

<!---I end up witht the three variables I need to render vehicle data on a
map now||--->
x=lonMidPoint
y=latMidPoint
zoom=D

I am not sure if this distance is coming back in Kilometers or meters,
also the greater the distance from a to b, the greater the size of the arc,
I don't think the arc is being accounted and I'm convinced its calculating
the distance from point a to point b
in a straight line.

This formula has been working fine when vehicles have been traveling around
the uk, the arc isn't that great,
but recently some customers vehicles have started to travel to Europe mainly
southern France and Germany,
if a customer checks out all his vehicles (some vehicles being in the UK and
now some in Europe) the arc is larger
and zoom is not correct, the center point is always correct, but the
distance between the greater points is not.

The vehicles cannot be seen on a map, unless I actually allow the user to
multiply the zoom
by doing this,

<CFPARAM NAME="ATTRIBUTES.Multiply" DEFAULT="0">
<CFSET ATTRIBUTES.D=ROUND(((ATTRIBUTES.D*3.5)*ATTRIBUTES.Multiply))>

This is purely a fix,

I have tried several other formula's to achieve the desired results but they
have not.
I have asked the ordinance survey, no  help,
also several other vendors including GPS satellite vendors, no help,

I am sorry about this OT post but if anyone knows a formula that is totally
accurate for calculating the actual distance between point a and point b
taking into consideration the arc fully, I would really love to here from
you.

RESPECTFULLY,

J

______________________________________________________________________
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to