readshpnw: Read a network from a “SpatialLines” or “SpatialLinesDataFrame” object
Description
A function to read a spatial network from a “SpatialLines” or “SpatialLinesDataFrame” object,
and resolve it into a “nodelist” and “edgelist” for the following conversion.
If “ELComputed” is TRUE, lengths of all the edges will be
returned as a numeric vector; otherwise it will be NULL.
Eadf
A data frame of attributes of the returned edges, of which the structure is
a data frame with [EdgeID,(attributes inherited from the input network data)]
nodexlist
A vector contains X-coordinates of all the nodes
nodeylist
A vector contains Y-coordinates of all the nodes
Arguments
ntdata
A “SpatialLinesDataFrame” or “SpatialLines” object
ELComputed
If TRUE, the length of each edge will be calculated and returned
longlat
If TRUE, distances on an ellipse with WGS84 parameters will be returned
Detailed
If TRUE, all the vertices within the polylines of a spatial network
will be recognised as nodes; if FALSE, only two endpoints of
each polyline are treated as nodes
ea.prop
A vector (of the length equalling to the number of edge attributes in
in the network “ntdata”) with values of 1 or 0:
1: the corresponding column in the data frame will be kept for
the new network;
0: the corresponding column in the data frame will not be kept.
This function plays the first step to convert a spatial network (in a “SpatialLines”
or “SpatialLinesDataFrame” object) into an “igraph” object by returning
a “nodelist” and “edgelist”.