| line_via | R Documentation |
Takes an origin (A) and destination (B), represented by the linestring l,
and generates 3 extra geometries based on points p:
line_via(l, p)
l |
A spatial lines object |
p |
A spatial points object |
From A to P1 (P1 being the nearest point to A)
From P1 to P2 (P2 being the nearest point to B)
From P2 to B
Other lines:
angle_diff(),
geo_toptail(),
is_linepoint(),
line2df(),
line2points(),
line_bearing(),
line_breakup(),
line_midpoint(),
line_segment(),
line_segment1(),
mats2line(),
n_segments(),
n_vertices(),
onewaygeo(),
points2line(),
toptail_buff()
library(sf)
l <- flowlines_sf[2:4, ]
p <- destinations_sf
lv <- line_via(l, p)
lv
# library(mapview)
# mapview(lv) +
# mapview(lv$leg_orig, col = "red")
plot(lv[3], lwd = 9, reset = FALSE)
plot(lv$leg_orig, col = "red", lwd = 5, add = TRUE)
plot(lv$leg_via, col = "black", add = TRUE)
plot(lv$leg_dest, col = "green", lwd = 5, add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.