I'm experimenting with using the sfnetworks package to query river networks. Specifically, I'd like to subset upstream portions of a river network relative to any given site.
I have a small river network dataset (available here) that I can convert…
I am trying to build a road network by using sfnetworks package in R, and I ran into an issue while running the last code chunk.
The below is my R code and data available here:
# Read in Data
## London borough boundary
LondonBoroughs <-…
I have two adjacent areas, on which I have a connected grid that each take the structure of sfc_LINESTRING. One area is larger and has a coarser grid, and the other is smaller with a finer grid.
I want to be able to do a join so at least one of the…
I have a network, and a focal node within the network. I have calculated the shortest paths to all other nodes from that node, and I'm trying to figure out how to make a sub-graph of the original network from that shortest path calculation.
The goal…
I am working with the R programming language.
I am interested in learning about how to calculate the driving distance (e.g. based on road networks) between two sets of coordinates.
For example:
CN Tower: 290 Bremner Blvd, Toronto, ON M5V 3L9…
While profiling my code I discovered that the part that sets the new weight in a graph takes the most time to run.
Since I have to do it repeatedly on much bigger graph than in this example, the running time adds up.
Is it possible to optimize…
I have an sfnetwork (net) and pts that I am combining using st_network_blend(). After calculating some new attributes for these points I would like to extract them and regain the columns of the original points. A spatial join using st_join won't…
I am trying to obtain edge lists of paths between two nodes using tidygraph. Here is an example
demo <- tbl_graph(nodes = tibble(name = c("A", "B", "C", "D")),
edges = tribble(~from, ~to,~id,
…
I have a shapefile containing linestrings that describes connection between cities in Brazil. I would like to convert these connections into a neighbourhood object with the cities' code set as the row name, making it compatible with my data frame:
>…
I’ve got a rooted tree setup in sfnetworks. It is derived from a line shapefile of a stream network. For each tributary in the stream network, there are obviously start and end nodes which sfnetworks determines, but there are also nodes connecting…
I am trying to split a river (lines) using dams (points) into connected segments between the dams.
The answer here is the closest to what I'm trying to achieve. The problem is that st_split uses the polygon boundaries as the 'blade' thus splitting…
I would like to do a bending between the network Riv and the points df with the function
library(sf)
net <- as_sfnetwork(Riv) |>
st_network_blend(df)
Nevertheless in this exemple, two points are removed in the output (38, 120).
I am looking for a…
I want to compute distance between nodes along a path (network).
I have two shapefiles.
One is a point layer representing train stations:
train_station <- structure(list(geometry = structure(list(structure(c(1789781.1763,
1036140.3792), class =…
I calculate a nested list of all possible paths of a given length in a graph and would like to select only certain paths´s based on first and last element value of the path.
Here is what I do:
First I create a graph
library(sfnetworks)
net =…
I have a motorway network with count points that can be matched to road links. However, they only match around half the osm links. The network is uni directional and it should be possible to assign data from joining links to the missing links.
I…