You are on page 1of 6

tools

1.tool manager select -->Distance calculator

2.Klik tools select Distance calculator

https://www.youtube.com/watch?v=O8JsMKAEjZg

hi friend,
try following in excel, refer the diagram

Angles-Radians, Distance-km

site A : (LonA,LatA), Azimuth : α, sector distance : x


site B : (LonB,LatB), Azimuth : β, sector distance : y

inter sector distance = d

location x = (Px,Qx)
location y = (Ry,Sy)

Qx = ASIN(SIN(LatA)*COS(x/6371) + COS(LatA)*SIN(x/6371)*COS(α))
Px = LonA + ATAN2(COS(x/6371)-SIN(LatA)*SIN(Qx), SIN(α)*SIN(x/6371)*COS(LatA))

Sy = ASIN(SIN(LatB)*COS(y/6371) + COS(LatB)*SIN(y/6371)*COS(β))
Ry = LonB + ATAN2(COS(y/6371)-SIN(LatB)*SIN(Sy), SIN(β)*SIN(y/6371)*COS(LatB))

d = ACOS(SIN(Qx)*SIN(Sy) + COS(Qx)*COS(Sy)*COS(Px-Ry)) * 6371

Bearing and distance calculation


methods
This page shows how the destination point is calculated in the Bearing
and Distance Calculator given a starting point, bearing and distance.

A method is given for calculating the destination point for ellipsoid earth
models using Vincenty's formula, and a second method is given to
calculate the destination point for a spherical earth model. For both
methods:

 Convert the starting point latitude 'lat1' (in the range -90 to 90) to radians.
lat1 = lat1 * PI/180
 Convert the starting point longitude 'lon1' (in the range -180 to 180) to
radians.
lon1 = lon1 * PI/180
 Convert the bearing 'brg' (in the range 0 to 360) to radians.
brg = brg * PI/180

Ellipsoid earth models


Note: the variable 'flat' below represents the earth's polar flattening used
in various ellipsoid models. For the commonly used WGS-84, let flat =
298.257223563.

1. Given the distance s in meters, the semi-major axis 'a' in meters, the semi-
minor axis 'b' in meters and the polar flattening 'flat'.
2. Calculate the destination point useing Vincenty's formula. Shortened
variable names are used.
f = 1/flat
sb=sin(brg)
cb=cos(brg)
tu1=(1-f)*tan(lat1)
cu1=1/sqrt((1+tu1*tu1))
su1=tu1*cu1
s2=atan2(tu1, cb)
sa = cu1*sb
csa=1-sa*sa
us=csa*(a*a - b*b)/(b*b)
A=1+us/16384*(4096+us*(-768+us*(320-175*us)))
B = us/1024*(256+us*(-128+us*(74-47*us)))
s1=s/(b*A)
s1p = 2*PI
3. Loop through the following while condition is true.
while (abs(s1-s1p) > 1e-12)
cs1m=cos(2*s2+s1)
ss1=sin(s1)
cs1=cos(s1)
ds1=B*ss1*(cs1m+B/4*(cs1*(-1+2*cs1m*cs1m)- B/6*cs1m*(-
3+4*ss1*ss1)*(-3+4*cs1m*cs1m)))
s1p=s1
s1=s/(b*A)+ds1
4. Continue calculation after the loop.
t=su1*ss1-cu1*cs1*cb
lat2=atan2(su1*cs1+cu1*ss1*cb, (1-f)*sqrt(sa*sa + t*t))
l2=atan2(ss1*sb, cu1*cs1-su1*ss1*cb)
c=f/16*csa*(4+f*(4-3*csa))
l=l2-(1-c)*f*sa* (s1+c*ss1*(cs1m+c*cs1*(-1+2*cs1m*cs1m)))
d=atan2(sa, -t)
finalBrg=d+2*PI
backBrg=d+PI
lon2 = lon1+l;
5. Convert lat2, lon2, finalBrg and backBrg to degrees
lat2 = lat2 * 180/PI
lon2 = lon2 * 180/PI
finalBrg = finalBrg * 180/PI
backBrg = backBrg * 180/PI
6. If lon2 is outside the range -180 to 180, add or subtract 360 to bring it back
into that range.
7. If finalBrg or backBrg is outside the range 0 to 360, add or subtract 360 to
bring them back into that range.

Note: the variables 'a', 'b' and 'flat' above have the following
relationships:
b = a - (a/flat)
flat = a / (a - b)

Spherical earth model


1. Given the distance 'dist' in miles or kilometers.
2. Let radiusEarth = 6372.7976 km or radiusEarth=3959.8728 miles
3. Convert distance to the distance in radians.
dist = dist/radiusEarth
4. Calculate the destination coordinates.
lat2 = asin(sin(lat1)*cos(dist) + cos(lat1)*sin(dist)*cos(brg))
lon2 = lon1 + atan2(sin(brg)*sin(dist)*cos(lat1), cos(dist)-sin(lat1)*sin(lat2))
5. Calculate the final bearing and back bearing.
dLon = lon1-lon2
y = sin(dLon) * cos(lat1)
x = cos(lat2)*sin(lat1) - sin(lat2)*cos(lat1)*cos(dLon)
d=atan2(y, x)
finalBrg = d+PI
backBrg=d+2*PI
6. Convert lat2, lon2, finalBrg and backBrg to degrees
lat2 = lat2 * 180/PI
lon2 = lon2 * 180/PI
finalBrg = finalBrg * 180/PI
backBrg = backBrg * 180/PI
7. If lon2 is outside the range -180 to 180, add or subtract 360 to bring it back
into that range.
8. If finalBrg or backBrg is outside the range 0 to 360, add or subtract 360 to
bring them back into that range.
What is the azimuth?
By the US Army definition, the term azimuth describes the angle created by two
lines: one joining your current position and the North Pole, and the one joining your
current position and the distant location. Azimuth is always measured clockwise. For
example, a point lying east from you would have an azimuth of 90°, but a point lying
west from you - of 270°.

How to calculate the azimuth from latitude


and longitude?
If you want to give a location of a point relative to your current position, you need to
provide two values: the azimuth and the distance. If Earth was flat, the latter would
simply by the straight-line distance between two points. As Earth is a sphere (or, to be
more precise, a geoid), it is the shortest travel distance between the two points ('as-
the-crow-flies').

To calculate the distance between two points, our azimuth calculator uses the
Haversine formula:
a = sin²(Δφ/2) + cos φ₁ ⋅ cos φ₂ ⋅ sin²(Δλ/2)

c = 2 ⋅ atan2 [√a, √(1−a)]

d = R ⋅ c

where:

 φ₁ is the latitude of initial point (positive for N and negative for S);
 φ₂ is the latitude of the final point (positive for N and negative for S);
 is the longitude of the initial point (positive for E and negative for
λ₁
W);
 λ₂ is the longitude of the final point (positive for E and negative for W);
 Δφ = φ₂ - φ₁;

 Δλ = λ₂ - λ₁;

 R is the radius of the Earth, expressed in meters (R = 6371 km).


The azimuth can be found using the same latitudes and longitudes with the following
equation:
θ = atan2 [(sin Δλ ⋅ cos φ₂), (cos φ₁ ⋅ sin φ₂ − sin φ₁ ⋅ cos φ₂ ⋅ cos Δλ)]

How to calculate the azimuth: an example


Let's assume we want to calculate the azimuth and distance required to determine the
position of Rio de Janeiro respective to London. All we have to do is follow these
steps:

1. Determine the longitude and latitude of London - our initial point. We


can find that φ₁ = 51.50° (positive, because it lies in the northern
hemisphere) and λ₁ = 0°.
2. Determine the longitude and latitude of Rio de Janeiro - our final point.
We can find that φ₂ = -22.97° (negative, because it lies in the southern
hemisphere) and λ₂ = -43.18° (also negative, because it lies in the
western hemisphere).
3. Calculate Δφ = φ₂ - φ₁ = -22.97° - 51.50° = -74.47°.
4. Calculate Δλ = λ₂ - λ₁ = -43.18° - 0 ° = -43.18°.
5. Insert all of the data into the Haversine formula to calculate the
distance:
a = sin²(Δφ/2) + cos φ₁ ⋅ cos φ₂ ⋅ sin²(Δλ/2) = sin²((-74.47°)/2) + cos 51.50° ⋅
cos (-22.97°) ⋅ sin²((-43.18°)/2) = 0.443

c = 2 ⋅ atan2 [√a, √(1−a)] = 2 ⋅ atan2 [√0.443, √(1−0.443)] = 1.458

d = R ⋅ c = 6371 * 1.458 = 9289 km

6. Calculate the azimuth from the azimuth equation:


θ = atan2 [(sin Δλ ⋅ cos φ₂), (cos φ₁ ⋅ sin φ₂ − sin φ₁ ⋅ cos φ₂ ⋅ cos Δλ)]

θ = atan2 [(sin (-43.18°) ⋅ cos (-22.97°)), (cos (51.50°) ⋅ sin (-22.97°) − sin
(51.50°) ⋅ cos (-22.97°) ⋅ cos (-43.18°))] = -2.455 rad

7. Convert the azimuth to a positive degree value:


θ = -2.455 rad = -140.65° = 219.35°

8. Congratulations! You have just calculated azimuth from latitude and


longitude.

You might also like