🚀 Tasks
As always, the data for this task is on moodle. Follow the instructions in Submission via GitHub Pages to create a new repo in the existing organization.
This week, you will do your do your own routing using the Veloland dataset from last week and some points of interestes (locations.gpkg on moodle). Import the two datasets and convert the Veloland dataset to an undirected network using sfnetworks, as you did last week.
- Subset a single location and call this
origin - Create a second object with all the other locations and call this
destination - Use the function
st_network_pathsfromsfnetworksto calculate the shortest paths fromorigin, todestination, using the columnlengthas weight - The output returns a two column data.frame. The column
edge_pathsretuns the row numbers of the line segments that constitute the shortest path. Use these values to create ansfobject for each path.
- Visualize the result in a map. Include
originanddestinationin your visualization. See Figure 1 for a possible way to visualize your result.