This is a simple wrapper around the geosphere function bearing()
to return the
bearing (in degrees relative to north) of lines.
line_bearing(l, bidirectional = FALSE)
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.
Other lines:
angle_diff()
,
geo_toptail()
,
is_linepoint()
,
line2df()
,
line2points()
,
line_match()
,
line_midpoint()
,
line_sample()
,
line_segment()
,
line_via()
,
mats2line()
,
n_sample_length()
,
n_vertices()
,
onewaygeo()
,
onewayid()
,
points2line()
,
toptail_buff()
,
toptailgs()
,
update_line_geometry()
# NOT RUN {
bearings_sf_1_9 <- line_bearing(flowlines_sf[1:5, ])
bearings_sf_1_9 # lines of 0 length have NaN bearing
bearings_sp_1_9 <- line_bearing(flowlines[1:5, ])
bearings_sp_1_9
plot(bearings_sf_1_9, bearings_sp_1_9)
line_bearing(flowlines_sf[1:5, ], bidirectional = TRUE)
line_bearing(flowlines[1:5, ], bidirectional = TRUE)
# }
Run the code above in your browser using DataLab