We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
At the moment there is no easy and automatic way to represent network measures estimated for the vertices.
The algorithm behind SpatialLinesNetwork() defines two attributes for the igraph object named x and y that represent the coordinates of the vertices:
SpatialLinesNetwork()
igraph
x
y
stplanr/R/SpatialLinesNetwork.R
Lines 152 to 156 in bbff85b
We can use these coordinates to create an sf object of POINTS and add/plot igraph measures related to vertices. For example:
sf
# packages library(sf) #> Linking to GEOS 3.8.0, GDAL 3.0.4, PROJ 6.3.1 library(stplanr) library(igraph) library(tmap) # data route_network_sf <- rnet_breakup_vertices(route_network_sf) sln_sf <- SpatialLinesNetwork(route_network_sf) # Estimate vertices measures sln_vertices_strength <- strength(sln_sf@g) # Rebuild the sf object sln_vertices <- st_as_sf( data.frame( x = sln_sf@g$x, y = sln_sf@g$y, strength = sln_vertices_strength ), coords = c("x", "y"), crs = 4326 ) # Map tm_shape(sln_sf@sl) + tm_lines() + tm_shape(sln_vertices) + tm_dots(size = "strength")
Created on 2020-05-19 by the reprex package (v0.3.0)
IMO the next step is to 1) document this "feature" or 2) create a new function to automatise this process.
The text was updated successfully, but these errors were encountered:
👍 I think that will greatly improve the usefulness of the class for relatively little new code.
Sorry, something went wrong.
No branches or pull requests
Problem
At the moment there is no easy and automatic way to represent network measures estimated for the vertices.
Solution
The algorithm behind
SpatialLinesNetwork()
defines two attributes for theigraph
object namedx
andy
that represent the coordinates of the vertices:stplanr/R/SpatialLinesNetwork.R
Lines 152 to 156 in bbff85b
We can use these coordinates to create an
sf
object of POINTS and add/plot igraph measures related to vertices. For example:Created on 2020-05-19 by the reprex package (v0.3.0)
IMO the next step is to 1) document this "feature" or 2) create a new function to automatise this process.
The text was updated successfully, but these errors were encountered: