Find the bearing of straight linesSource:
This function returns the bearing (in degrees relative to north) of lines.
A spatial lines object
Should the result be returned in a bidirectional format? Default is FALSE. If TRUE, the same line in the oposite direction would have the same bearing
Returns a boolean vector. TRUE means that the associated line is in fact a point (has no distance). This can be useful for removing data that will not be plotted.
l <- flowlines_sf[1:5, ] bearings_sf_1_9 <- line_bearing(l) bearings_sf_1_9 # lines of 0 length have NaN bearing #>  -92.04942 -102.44566 -143.83660 -173.33154 170.51696 b <- line_bearing(l, bidirectional = TRUE) r <- routes_fast_sf[1:5, ] b2 <- line_bearing(r, bidirectional = TRUE) plot(b, b2)