line_bearing | R Documentation |
This function returns the bearing (in degrees relative to north) of lines.
line_bearing(l, bidirectional = FALSE)
l |
A spatial lines object |
bidirectional |
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_breakup()
,
line_midpoint()
,
line_segment()
,
line_via()
,
mats2line()
,
n_vertices()
,
onewaygeo()
,
points2line()
,
toptail_buff()
lib_versions <- sf::sf_extSoftVersion()
lib_versions
# fails on some systems (with early versions of PROJ)
if (lib_versions[3] >= "6.3.1") {
bearings_sf_1_9 <- line_bearing(flowlines_sf[1:5, ])
bearings_sf_1_9 # lines of 0 length have NaN bearing
line_bearing(flowlines_sf[1:5, ], bidirectional = TRUE)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.