Re: Advanced post code matching
- From: CDMAPoster@xxxxxxxxxxxxxxxx
- Date: Thu, 20 Nov 2008 03:11:34 -0800 (PST)
On Nov 16, 7:12 am, Chuck <libb...@xxxxxxxxxxxxxx> wrote:
On Sat, 15 Nov 2008 16:01:53 -0800 (PST), CDMAPos...@xxxxxxxxxxxxxxxx wrote:
On Nov 15, 6:14 am, lyle fairfield <lyle.fairfi...@xxxxxxxxx> wrote:
A Google search of "PostCode Latitude" brings up at least one
reference to a publicly available file of the coordinates of areas
associated with UK Postal Codes. One could use these to calculate in-
line distances with code like this:
Const PI# = 3.14159265358979
' circumference in kilometers
Const Circumference# = 40123.648
Public Function GreatCircleDistance#( _
ByVal Latitude0#, ByVal Longitude0#, _
ByVal Latitude1#, ByVal Longitude1#)
On Error Resume Next
Dim Arc#
Dim CosArc#
If Latitude0 = Latitude1 And Longitude0 = Longitude1 Then
GreatCircleDistance = 0
Else
Latitude0 = Radians(Latitude0)
Longitude0 = Radians(Longitude0)
Latitude1 = Radians(Latitude1)
Longitude1 = Radians(Longitude1)
CosArc = (Sin(Latitude0) * Sin(Latitude1)) + _
(Cos(Latitude0) * Cos(Latitude1) * Cos(Longitude0 -
Longitude1))
Arc = Degrees(Atn(-CosArc / Sqr(-CosArc * CosArc + 1)) + 2 *
Atn(1))
GreatCircleDistance = Arc / 360 * Circumference
End If
End Function
Private Function Radians#(ByVal Degrees#)
Radians = PI * Degrees / 180
End Function
Private Function Degrees#(ByVal Radians#)
Degrees = Radians / PI * 180
End Function
In:
http://groups.google.com/group/microsoft.public.access/browse_frm/thr...
I derived a formula for the great circle distance between two points
given their latitude and longitude coordinates. I also proved that it
is correct, although some mathematical simplification should be done
for comparison with other formulae. Of course, if you're not aware
that the dot product of two unit vectors gives the cosine of the angle
between them, then the simple proof is not as obvious :-). I have a
lot more confidence in the formulae that I can derive or show to be
equivalent to what I derive. Then when there's a difference I can
determine what assumptions or simplifications were made.
James A. Fortune
CDMAPos...@xxxxxxxxxxxxxxxx
The only assumptions in lyle's functions is that the earth is spherical and
that its diameter is 12771.753 KM - both of which, for all practical purposes
are true.
Chuck
--
I agree since his formula is exactly equivalent to mine once the
cosine of a sum trig identity is applied. My point remains whether
there is a difference in the formulae or not. It is interesting to
note that for a much tougher calculation involving the sun's position
in the sky for any latitude and longitude at a given time, one of the
two angles turned out to be the arccosine of a product of cosine
terms. That derivation used vector dot and cross products to get the
solution and the formula was fairly accurate in spite of the fact that
it assumed a circular orbit of the earth about the sun. Having a
closed-form solution was a nice plus. You could get approximate
sunrise and sunset times by solving for when the vertical angle is
zero, plus you could find the different sunrise and sunset azimuth
angles as they change throughout the year. I believe that in
Australia the sun swings into the northern sky (year round once the
latitude is greater than the tilt of the Earth's axis).
James A. Fortune
CDMAPoster@xxxxxxxxxxxxxxxx
In the absence of daylight savings time, if your time zone is not too
irregular your actual solar noon can be up to about half an hour
before or after nominal noon depending on how far East or West you are
of the center of your time zone.
.
- References:
- Advanced post code matching
- From: comcraft1966
- Re: Advanced post code matching
- From: lyle fairfield
- Re: Advanced post code matching
- From: CDMAPoster
- Re: Advanced post code matching
- From: Chuck
- Advanced post code matching
- Prev by Date: Re: Want to transfer data to/from Acess database?
- Next by Date: Re: Multiple Versions of Outlook
- Previous by thread: Re: Advanced post code matching
- Next by thread: Inserting rows in Excel from Access
- Index(es):
Relevant Pages
|