-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathline_via.Rd
58 lines (57 loc) · 1.43 KB
/
line_via.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/line_via.R
\name{line_via}
\alias{line_via}
\title{Add geometry columns representing a route via intermediary points}
\usage{
line_via(l, p)
}
\arguments{
\item{l}{A spatial lines object}
\item{p}{A spatial points object}
}
\description{
Takes an origin (A) and destination (B), represented by the linestring \code{l},
and generates 3 extra geometries based on points \code{p}:
}
\details{
\enumerate{
\item From A to P1 (P1 being the nearest point to A)
\item From P1 to P2 (P2 being the nearest point to B)
\item From P2 to B
}
}
\examples{
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)
}
\seealso{
Other lines:
\code{\link{angle_diff}()},
\code{\link{geo_toptail}()},
\code{\link{is_linepoint}()},
\code{\link{line2df}()},
\code{\link{line2points}()},
\code{\link{line_bearing}()},
\code{\link{line_breakup}()},
\code{\link{line_midpoint}()},
\code{\link{line_segment}()},
\code{\link{line_segment1}()},
\code{\link{mats2line}()},
\code{\link{n_segments}()},
\code{\link{n_vertices}()},
\code{\link{onewaygeo}()},
\code{\link{points2line}()},
\code{\link{toptail_buff}()}
}
\concept{lines}