Closed fnattino closed 1 week ago
We should follow the vignette on corridor delineation (especially the last part) as a guide line: https://cityriverspaces.github.io/CRiSp/articles/corridor-delineation.html
@cforgaci I have started to think how to best accommodate the new functionalities described above in CRiSp, and I thought we could maybe do some refactoring to structure things in a way that would make this task easier. I have thought about the following structure, what do you think?
osmdata.R
module, with functions:
get_osm_city_boundary()
get_osm_river()
get_osm_highways()
get_osm_railways()
get_osmdata()
, internally calling all of the above and returning a list of datasets similar to what happens in data-raw/bucharest.R
(actually, at this point, data-raw/bucharest.R
would become just a call to get_osmdata()
).network.R
module, to collect all tasks purely related to network tasks, with functions such as:
flatten_network()
clean_network()
as.network(edges, flatten = FALSE, clean = FALSE)
that creates the network from the edges and optionally run the two functions above).add_weights()
, to add weights as required for the corridor delineation.shortest_path()
, to find the shortest path in the network, as required to find corridor edges and capping segments.strokes()
, to calculate strokes as required for the segmentation.corridor.R
module, using essentially all the functions provided by network.R
, but with focus on the corridor delineation, e.g. with functions like:
corridor_edges()
to properly set up the input and running add_weight()
and shortest_path()
from the network module.cap_corridor()
to close the edges.corridor()
to run the two function above in one go)delineate.R
module, with the all-at-once functions, which run everything from data download to delineation:
delineate_corridor()
delineate_segments()
delineate_riverspace()
@fnattino, I drafted the osmdata module. Please have a look.
The implemented procedure is purely based on a shortest path algorithm, while we have currently updated it to also account for the initial guess of the corridor. In addition, we have improved the method to draw the initial corridor guess to account for the DEM (see also #35, which is related to building the DEM module).
We should update the corridor delineation module to reflect these updates: https://github.com/CityRiverSpaces/prototyping/blob/main/notebooks/corridor/corridor_bucharest_river-valley.qmd