coords2Lines | R Documentation |
SpatialLines*
Create a SpatialLines*
object from a Line
object or set of point
coordinates in one go, i.e. without being required to run through the single
steps outlined in sp::SpatialLines()
.
## S4 method for signature 'matrix' coords2Lines(coords, ID, data, match.ID = TRUE, ...) ## S4 method for signature 'Line' coords2Lines(coords, ID, data, match.ID = TRUE, ...)
coords |
|
ID |
|
data |
|
match.ID |
|
... |
Further arguments passed on to |
If 'data' is missing, a SpatialLines
object; else a
SpatialLinesDataFrame
object.
library(sp) coords1 <- cbind(c(2, 4, 4, 1, 2), c(2, 3, 5, 4, 2)) sln1 <- coords2Lines(coords1, ID = "A") coords2 <- cbind(c(5, 4, 2, 5), c(2, 3, 2, 2)) sln2 <- coords2Lines(coords2, ID = "B") plot(sln1, col = "grey75") plot(sln2, col = "grey25", add = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.