View source: R/plotting-helpers.R
| sp2sl | R Documentation |
SpatialLinesThis will convert 2 objects whose coordinates can be extracted with coordinates
(e.g., sp::SpatialPoints*) to a single SpatialLines object.
The first object is treated as the "to" (destination), and the second object the "from" (source).
This can be used to represent directional SpatialLines, especially with with arrow heads,
as in Plot(sl, length = 0.1).
sp2sl(sp1, from)
sp1 |
a |
from |
a |
caribou <- terra::vect(
x = cbind(
x = stats::runif(1e1, -50, 50),
y = stats::runif(1e1, -50, 50)
)
)
caribouFrom <- terra::vect(
x = cbind(
x = stats::runif(1e1, -50, 50),
y = stats::runif(1e1, -50, 50)
)
)
caribouLines <- sp2sl(caribou, caribouFrom)
if (interactive()) {
clearPlot()
Plot(caribouLines, length = 0.1)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.