ang_head: The angle from point A to B.

Description Usage Arguments Value Author(s) References Examples

View source: R/ang_head.R

Description

Giver the angle from a origin to a certain destination.

Usage

1
ang_head(Ta, La, Tb, Lb)

Arguments

Ta

Latitude of the origin point.

La

Longitude of the origin point.

Tb

Latitude of the destination point.

Lb

Longitude of the destination point.

Value

b

The angle direction.

Author(s)

Natan Freitas Leite.

References

http://www.igismap.com/formula-to-find-bearing-or-heading-angle-between-two-points-latitude-longitude/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## The function is currently defined as
function (Ta, La, Tb, Lb)
{
    Ta = rad(Ta)
    Tb = rad(Tb)
    La = rad(La)
    Lb = rad(Lb)
    dL = abs(Lb - La)
    x = cos(Tb) * sin(dL)
    y = cos(Ta) * sin(Tb) - sin(Ta) * cos(Tb) * cos(dL)
    b = atan2(x, y)
    b = deg(b)
    return(b)
  }

##Kansas City: 39.099912, -94.581213 -> St Louis: 38.627089, -90.200203
##Result should be: ang.head=96.5126242349993
a=ang_head(39.099912, -94.581213,38.627089, -90.200203)
a

Bolshom/optimumtt documentation built on May 24, 2019, 8:56 a.m.