Description Usage Arguments Details Value Slots Note Author(s) Examples
SpatialNetwork: a Class for Spatial Networks (lines and edges)
1 | SpatialNetwork(sl, g, weight, weightfield, direction, zero)
|
sl |
object of one of (a sublasses of) SpatialLines, with links |
g |
object of class igraph; if missing, the graph is sorted out from the links |
weight |
weight for links (defaults to length of linestring) |
weightfield |
character; name of the attribute field of |
direction |
numeric; if omitted, undirected graph, else integer vector indicating direction of a link: -1 for up-link, 0 for two-way, or 1 for down-link |
zero |
numeric; zero threshold passed on to zerodist |
A class to store spatial networks, such as a road network.
object of class SpatialNetwork-class
bbox
matrix, holding bounding box
proj4string
object of class CRS-class
lines
list
data
data.frame, holding attributes associated with lines
g
object of a subclass of igraph
weightfield
character; describing the weight field used
note
Edzer Pebesma
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(sp) # Lines, SpatialLines
l0 = cbind(c(1, 2), c(0, 0))
l1 = cbind(c(0, 0, 0), c(0, 1, 2))
l2 = cbind(c(0, 0, 0), c(2, 3, 4))
l3 = cbind(c(0, 1, 2), c(2, 2, 3))
l4 = cbind(c(0, 1, 2), c(4, 4, 3))
l5 = cbind(c(2, 2), c(0, 3))
l6 = cbind(c(2, 3), c(3, 4))
LL = function(l, ID) Lines(list(Line(l)), ID)
l = list(LL(l0, "e"), LL(l1, "a"), LL(l2, "b"), LL(l3, "c"), LL(l4, "d"), LL(l5, "f"), LL(l6, "g"))
sl = SpatialLines(l)
sln = SpatialNetwork(sl)
plot(sln)
points(sln)
library(igraph) # E
text(V(sln@g)$x, V(sln@g)$y, E(sln@g), pos = 4)
plot(sln@g)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.