Re: Search within 50 miles of xxxx zipcode



Tina:
In addition remember the formula given is only a line-off-sight, or lack
off, Air-Distance you are getting.
If the 50 radius takes you over a mountain range, or a body of water, then
your driving distance can vary a great deal.
If this is an application that can cost you $$ for driving etc.. then you
need to study the area you are dealing with and look for some
costly-exceptions to avoid.

Some formulas are available for the USA for more accuracy + your exceptions
to avoid bad and costly decisions.

Lit.

"Kevin Spencer" <unclechutney@xxxxxxxxxxxx> wrote in message
news:upsUGNrzHHA.4928@xxxxxxxxxxxxxxxxxxxxxxx
Here are a few methods that calculate distance between 2 points of
Latitude and Longitude. Calculations of distance between points of
Latitude and Longitude are always approximate, as the surface of the earth
is curved, and the earth is an oblate spheroid, rather than a sphere, and
therefore, distance is distance along a curve that varies from one point
on the surface to another. There are methods of calculating distance that
are more or less accurate, and they become increasingly complex as they
become increasingly accurate. The following methods treat the earth as a
sphere, and use a mean earth radius (average of the radius based upon the
radius at the poles and equator). They should be accurate enough for this
purpose.

Note that there is a reference to a struct called "LatLong," which is
simply a struct containing 2 doubles:

public const double MeanEarthRadiusFeet = 20903215.2;

public static double DistanceRadians(LatLong PointA, LatLong PointB)
{
double aLat, aLong, bLat, bLong;

aLat = PointA.Lat * (Math.PI / 180);
aLong = PointA.Long * (Math.PI / 180);
bLat = PointB.Lat * (Math.PI / 180);
bLong = PointB.Long * (Math.PI / 180);

return Math.Acos(Math.Cos(aLat) * Math.Cos(bLat) *
Math.Cos(aLong - bLong)
+ Math.Sin(aLat) * Math.Sin(bLat));
}

public static double Distance(LatLong PointA, LatLong PointB)
{
double radians = DistanceRadians(PointA, PointB);
return radians * MeanEarthRadiusFeet; // Distance in feet
(convert to whatever)
}

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Lit" <sql_agentman@xxxxxxxxxxx> wrote in message
news:uBERoBizHHA.3772@xxxxxxxxxxxxxxxxxxxxxxx
Tina,

You need a zipcode table with longitude and Latitude Info about every
zipcode and this info actually is available.
then you need to calculate using the Longitude and Latitude,
I contacted JPL in Pasadena one time and they actually referred me to
some formulas already written in C++ , and other languages, but that was
years ago.
If you contact NASA or search on their we site you may find Formulas that
can give you the distance between earth coordinates.
there are many and since the earth is not a perfect sphere some formulas
are more accurate than others.
but if you get an approximate numbers then that should be fine. there is
no such thing as exact.

Search the web you might find a component that does that for you already.

hope that helps

Lit



"Tina" <TinaMSeaburn@xxxxxxxxxxxxxxxx> wrote in message
news:ueN687hzHHA.5160@xxxxxxxxxxxxxxxxxxxxxxx
I need to be able to provide a proximity search by zip code. I have a
table of job opportunities with the zip code where they exist. So I need
to be able to list zip codes that are within xx miles of 99999 zip code.

How is this done?
Thanks,
Tina







.



Relevant Pages

  • Re: Calculating a Distance on the Surface of the Earth
    ... latitude and longitude. ... I'd actually be above the surface of the earth due to the ... to the surface of the earth, I'd like to know the distance between ... longitude of the second point. ...
    (sci.geo.satellite-nav)
  • Re: Inverse Square Law and Infinity
    ... | then a seems to go to infinity. ... | separation distance of the cosmic "R" between 2 elementary electrical ... is the radius R at the planet's surface is the radius of the larger body. ... R+r is the distance from the centre of the Earth ...
    (sci.physics)
  • Re: Search within 50 miles of xxxx zipcode
    ... Here are a few methods that calculate distance between 2 points of Latitude ... and Longitude. ... the earth is an oblate spheroid, rather than a sphere, and therefore, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Latitude / longitude distance and bearing.
    ... (*Not* the distance along ... Rotate Earth through the poles until 'b' is at longitude zero; ...
    (sci.math)
  • Re: Calculating a Distance on the Surface of the Earth
    ... I'd actually be above the surface of the earth due to the ... The latitude/longitude of a point on the earth's surface and the distance and direction to a second point, compute the latitude and longitude of the second point. ...
    (sci.geo.satellite-nav)

Loading