Hussein-Mahfouz / drt-potential

3 stars 0 forks source link

Aggregating flows onto shortest paths #26

Closed Hussein-Mahfouz closed 1 month ago

Hussein-Mahfouz commented 5 months ago

This is linked to #16 and is part of a method suggested by @mem48 . I am documenting here so that it is easy to transfer to any document I am writing

_1. Run shortest path calculations for all OD pairs and retained the geometries: code here_

2. Keep only OD pairs with no direct bus between them. The number of transfers is obtained from the routing engine

3. Aggregate flows at road segment level

4. Identify intervention:

Results

Overline (Option 1)

map_aggregate_flows_overline_vs_base

Overline (Option 1) vs Overline + Merge (Option 2)

map_aggregate_flows_overline_vs_merge

It looks like the merging after overline is only having a minor effect. The merging function is not working very well. See the zoomed in screenshot as an example of partial merging but also unwanted edits to the network structure (I can't upload an html file here for browsing the results)

image

I could work on editing the simplify_graph function, but it will be a time sink and I think for now overline is sufficient. Merging functionality is being addressed by https://github.com/nptscot/networkmerge. @Robinlovelace do you think it would be easy to use the functions from that work?

Robinlovelace commented 5 months ago

I could work on editing the simplify_graph function, but it will be a time sink and I think for now overline is sufficient. Merging functionality is being addressed by https://github.com/nptscot/networkmerge. @Robinlovelace do you think it would be easy to use the functions from that work?

should be easy and there's an issue to make it even easier that should be fixed at some point: https://github.com/nptscot/networkmerge/issues/97

Do you have a minimal example of a network in need of simplification? Half the battle is re-joining the attributes to the simplified network but that should be sorted by rnet_merge(): https://docs.ropensci.org/stplanr/reference/rnet_merge.html

Hussein-Mahfouz commented 5 months ago

I'll look at the code logic and rnet_merge. A minimal example could be something like this:


library(osmdata)

# bbox of Moor Allerton in Leeds
roads <- opq (bbox = c (-1.544640, 53.843780, -1.524073, 53.852689)) %>% 
  add_osm_feature (key = "highway") %>%
  osmdata_sf ()

# plot the queried roads
plot(roads$osm_lines["highway"])
Robinlovelace commented 5 months ago

OK, ideal test case for something I'm looking at with @wangzhao0217.. Will aim to get back but may not be until next week.

Hussein-Mahfouz commented 5 months ago

Another thing I could do is to concentrate the demand onto the main roads by either:

Both of these would concentrate demand more while giving an indication of high-demand arteries

anisotropi4 commented 5 months ago

I have done some work with network simplification (https://github.com/anisotropi4/arctic-tern) and aggregating rail passenger travel flows onto a rail centre-line track-model (https://github.com/anisotropi4/kingfisher).

I don't know if this is of interest but @Robinlovelace suggested I ought to mention this as it might be.

Robinlovelace commented 5 months ago

Heads-up @Hussein-Mahfouz here's the network merge code I wrote to join attributes to simplified geometry: https://github.com/nptscot/networkmerge/blob/101-test-for-road-network-in-leeds/test-osm-simplify-open-roads.qmd (OS Open Roads in this case)

Hussein-Mahfouz commented 5 months ago

Thanks @anisotropi4 and @Robinlovelace !

@anisotropi4 I'll go through the links and may come back with questions