Other#

Distance Calculation#

Any point on the Earth’s surface can be located by its latitude and longitude coordinates.

Latitude is the angle above or below the equator in degrees. The equator is zero degrees, the North pole is North 90 degrees latitude, and the South pole is South 90 degrees latitude. The continental United States falls between 25 and 50 degrees North.

Longitude is the angle East or West of the Greenwich meridian. The continental United States is between 70 and 125 degrees West.

Approximate Solutions#

One degree of latitude is equal to 69.1 miles. One degree of longitude is equal to 69.1 miles at the equator. North or South of the equator, 1 degree of longitude is a smaller distance. It’s reduced by the cosine of the latitude. Dividing the latitude number by 57.3 converts it to radians.

\[DistanceLat = 69.1\, (Lat_2 - Lat_1)\]
\[\begin{split}DistanceLong = 69.1\, (Long_2- Long_1)\, cos\, (\frac{Lat_1}{57.3})\\\end{split}\]
\[Distance = \sqrt{DistanceLat^2 + DistanceLong^2}\]

If you don’t want to use the COS function, then a good approximate solution is:

\[DistanceLat = 69.1\, (Lat_2 - Lat_1)\]
\[DistanceLong = 53\, (Long_2 - Long_1)\]
\[Distance = \sqrt{DistanceLat^2 + DistanceLong^2}\]

Exact Solution#

To calculate the exact distance between points requires spherical geometry.

\[D = 3959\, cos^{-1}\, (sin\, (Lat_1)\, sin(Lat_2)\, + cos\, (Lat_1)\, cos\, (Lat_2)\, cos\, (Long_2 - Long_1))\]

The above formula has one major problem: most computer languages do not support the arccosine function. Therefore a different form is necessary, one that uses the arctangent function that most languages embrace.

\[\begin{split}D = 3959\, tan^{-1}\, (\frac{\sqrt{1-A^2}}{A})\\\end{split}\]

where A is equal to:

\[A = sin\, (Lat_1)\, sin\, (Lat_2) + cos\, (Lat_1)\, cos\, (Lat_2)\, cos\, (Long_2-Long_1)\]

Most computer languages compute the sine and cosine function with the angle given in radians. To convert degrees to radians, divide degrees by the constant:

\[\begin{split}57.3\,({\frac{180}{\pi}\\})\end{split}\]

In BASIC this would be programmed as follows:

\[C = 57.3\]
\[\begin{split}A = sin\, ({\frac{Lat_1}{C})\\}\, sin\, ({\frac{Lat_2}{C})\\} + cos\, ({\frac{Lat_1}{C}\\})\, cos\, ({\frac{Lat_2}{C}\\})\, cos\, ({\frac{Long_2}{C}\\}-{\frac{Long_1}{C}\\})\end{split}\]
\[\begin{split}D = 3959\, tan^{-1}\, (\frac{\sqrt{1-A^2}}{A})\\\end{split}\]

Where:

D = distance in statue miles from the first to the second point.

C = degrees to radians constant 57.3.

Lat1 = latitude of the first point in degrees.

Long1 = longitude of the first point in degrees.

Lat2 = latitude of the second point in degrees.

Long2 = longitude of the second point in degrees.

NOTE: Dividing the latitude number by 57.3 converts it to radians.

Since all ZIP Code points in the United States are North latitude and West longitude, there is no need to check the sines (positive and negative) of the latitudes and longitudes.

Some programming languages, such as dBASE II/III, do not have the functions of the sine, cosine and arctangent. Also, the formulas given are time-consuming to calculate. A simpler but less accurate method is given here:

\[D = 69.1\, \sqrt{(Lat_2-Lat_1)^{2} + 0.6\, (Long_2 - Long_1)^{2}}\]

Although this formula is not as accurate as the first great circle method, it will give good results for most applications.

In basic, it is written as follows:

\[D = 69.1\, \sqrt{(Lat_2-Lat_1)^{2} + .6\, (Long_2 - Long_1)^{2}}\]

In dBASE III, it is written as follows:

\[D = 69.1\, \sqrt{(Lat_2-Lat_1)^{2} + 0.6\, (Long_2 - Long_1)^{2}}\]

To make using the database easier, the latitudes and longitudes are given in the decimal format instead of the degree, minute and second format. The latter would require the additional steps of converting seconds to fractions of a minute and then minutes to a fraction of a degree.

Bearing Formula#

The bearing is the direction from the first point to the second point. It is expressed as an angle from North in degrees. Due North is a bearing of zero degrees, East is a bearing of 90 degrees, South is 180, and west is 270.

The bearing from the first point to the second is calculated with:

\[B = tan^{-1}\, (\frac{sin(Lat_1)\, sin(Long_2 - Long_1)}{sin(Lat_2)\, cos(Lat_1) - cos(Lat_2)\, sin(Lat_1)\, cos(Long_2 - Long_1)})\]

Since the ARCTAN function gives the angle in radians, it is necessary to convert B to degrees by multiplying by

\[\begin{split}57.3\,({\frac{180}{\pi}\\})\end{split}\]

To use this equation requires some special considerations. This example assumes that Lat1, Lat2, Long1, Long2 have been converted to radians.

Use the following steps:

\[N = sin\, (Lat_1)\, sin\, (Long_1 - Long_2)\]
\[D = sin\, (Lat_2)\, cos\, (Lat_1)\, – \, cos\, (Lat_2)\, sin\, (Lat_1)\, cos\, (Long_1 - Long_2)\]
\[\begin{split}B = 57.3\, tan^{-1}\, ({\frac{N}{D}\\})\end{split}\]

If (D > 0) then (B = 360 + B)

If (D < 0) then (B = 180 + B)

If (B < 0) then (B = 360 + B)

Where:

N is the Numerator.

D is the Denominator.

B is the Bearing.

Examples#

The following examples should give you a feel for the numbers. For these examples, we will use the points of Schenectady, NY and Los Angeles, CA.

First Point is in Schenectady, NY, 12345

Lat1 = 42.8145

Long1 = 73.9380

Second Point is in Los Angeles, CA, 90001

Lat1 = 34.0515

Long1 = 118.2420

Example 1: Approximate Formula (1)

\[DistanceLat = 69.1\, (Lat_2 - Lat_1) = 605.5\]
\[DistanceLong = 69.1\, (Long_2- Long_1)\, cos\, (\frac{42.8145}{57.3}) \ = 2245.8\]
\[Distance = 2326.0 \ miles\]

Example 2: Approximate Formula (2)

\[DistanceLat = 69.1\, (Lat_2 - Lat_1) = 605.5\]
\[DistanceLong = 53\, (Long_2 - Long_1) = \ 2348.1\]
\[Distance = 2424.9 \ miles\]

Example 3: Exact Solution Formula

\[\begin{split}A_1 = sin\, ({\frac{Lat_1}{57.3})\\}\, sin\, ({\frac{Lat_2}{57.3})\\} = \ 0.3805\end{split}\]
\[\begin{split}A_2 = cos\, ({\frac{Lat_1}{57.3}\\})\, cos\, ({\frac{Lat_2}{57.3}\\})\, cos\, ({\frac{Long_2}{57.3}\\}-{\frac{Long_1}{57.3}\\}) = \ 0.4350\end{split}\]
\[A =\ A_1 + A_2 = \ 0.8155\]
\[\begin{split}D = 3959\, tan^{-1}\, (\frac{\sqrt{1-A^2}}{A})\\\end{split}\]
\[D = 3959\, tan^{-1}\, (\frac{\sqrt{1-(0.8155)^2}}{0.8155}) \ = 2443.4\]

Example 4: Bearing Formula

\[\begin{split}N = sin\, ({\frac{Lat_1}{57.3})\\}\, sin\, ({\frac{Long_2}{57.3}\\}-{\frac{Long_1}{57.3}\\}) = \ 0.4747\end{split}\]
\[\begin{split}D_1 = sin\, ({\frac{Lat_2}{57.3})\\}\, cos\, ({\frac{Lat_1}{57.3})\\} = \ 0.4107\end{split}\]
\[\begin{split}D_2 = cos\, ({\frac{Lat_2}{57.3})\\}\, sin\, ({\frac{Lat_1}{57.3})\\}\, cos\, ({\frac{Long_2}{57.3}\\}-{\frac{Long_1}{57.3}\\}) = \ 0.4029\end{split}\]
\[\begin{split}B = 57.3\, tan^{-1}\, ({\frac{N}{D_1 - D_2}\\}) = \ -81.9 \,Degrees\end{split}\]
\[Bearing = 360 + B = 360 - 89.1\]
\[Bearing = 270.9\, degrees\, from\, North\]

Abbreviations and Codes#

Military#

Abbreviation

Region

AA

Atlantic

AP

Pacific

AE

Europe

State#

Abbreviation

Code

State

AL

01

Alabama

AK

02

Alaska

AZ

04

Arizona

AR

05

Arkansas

CA

06

California

CO

08

Colorado

CT

09

Connecticut

DE

10

Delaware

DC

11

District of Columbia

FL

12

Florida

GA

13

Georgia

HI

15

Hawaii

ID

16

Idaho

IL

17

Illinois

IN

18

Indiana

IA

19

Iowa

KS

20

Kansas

KY

21

Kentucky

LA

22

Louisiana

ME

23

Maine

MD

24

Maryland

MA

25

Massachusetts

MI

26

Michigan

MN

27

Minnesota

MS

28

Mississippi

MO

29

Missouri

MT

30

Montana

NE

31

Nebraska

NV

32

Nevada

NH

33

New Hampshire

NJ

34

New Jersey

NM

35

New Mexico

NY

36

New York

NC

37

North Carolina

ND

38

North Dakota

OH

39

Ohio

OK

40

Oklahoma

OR

41

Oregon

PA

42

Pennsylvania

RI

44

Rhode Island

SC

45

South Carolina

SD

46

South Dakota

TN

47

Tennessee

TX

48

Texas

UT

49

Utah

VT

50

Vermont

VA

51

Virginia

WA

53

Washington

WV

54

West Virginia

WI

55

Wisconsin

WY

56

Wyoming

AS

60

American Samoa

FM

64

Micronesia

GU

66

Guam

MH

68

Marshall Islands

MP

69

North Mariana Islands

PW

70

Palua

PR

72

Puerto Rico

UM

74

Minor Islands

VI

78

Virgin Islands

Release Schedule#

Release Date Schedule

2024-04-08

2024-05-06

2024-06-10

2024-07-08

2024-08-05

2024-09-09

2024-10-07

2024-11-04

2024-12-09

2025-01-06

2025-02-10

2025-03-10

2025-04-07