Re: Advanced post code matching



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.
.



Relevant Pages

  • Re: equatorial sundails
    ... the angle to the horizontal is the same as the lattitude; ... and California, which are within the temperate latitude, and now that I ... the gnomon on any sundial I've seen has always been slanted. ... many lower priced sundials sold for home gardens don't have ...
    (rec.pets.cats.anecdotes)
  • Re: PL/I, COBOL, Advantages, Equivalence, et al
    ... Would you have separate attributes for CGS vx MKS units? ... Then, we can define two new types, latitude and longitude, ... type Latitude is new Angle; ...
    (comp.lang.pl1)
  • Re: Finding nearby zip codes (or maybe area codes) programatically
    ... For Belgium I made the latitude and longitude myself with data ... I would have a list with just all the postal codes and then I would use ... If America weren't incomparably ignorant, ...
    (comp.lang.php)
  • Re: Calling a class within a class
    ... Angle, then make the Latitude property read only. ... Public Property Set Latitude ... Geo provides a reference to that class through the Latitude ...
    (microsoft.public.vb.general.discussion)
  • Re: Latitude, Longitude, and Radius
    ... > I've got a database with Zip codes. ... This also includes the latitude ... > and longitude values stored as singles (lat 42.17444, ... it will also display all other zip codes within a 25 mile ...
    (microsoft.public.vb.general.discussion)