Learn R Programming

TCHazaRds (version 1.1.2)

returnBearing: Return the Bearing for Line Segments

Description

Return the Bearing for Line Segments

Usage

returnBearing(x)

Value

array of bearings see geosphere::bearing, i.e the Forward direction of the storm geographic bearing, positive clockwise from true north

Arguments

x

spatial vector with line segments (two connected points)

Examples

Run this code
### IBTRACS HAS the WRONG BEARING!!
require(terra)
northwardTC <- vect(cbind(c(154,154),c(-26.1,-26)),"lines",crs="epsg:4283") #track line segment
easthwardTC <- vect(cbind(c(154,154.1),c(-26,-26)),"lines",crs="epsg:4283") #track line segment
southhwardTC <- vect(cbind(c(154,154),c(-26,-26.1)),"lines",crs="epsg:4283") #track line segment
westwardTC <- vect(cbind(c(154.1,154),c(-26,-26)),"lines",crs="epsg:4283") #track line segment
returnBearing(northwardTC)
returnBearing(easthwardTC)
returnBearing(southhwardTC)
returnBearing(westwardTC)

Run the code above in your browser using DataLab