SpatialNetwork: a Class for Spatial Networks (lines and edges)
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 |
object of class SpatialNetwork-class
A class to store spatial networks, such as a road network.
note
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
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#> #>#>#> #>#>#> #>