-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
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
Elevation / gradient source #18
Comments
The goal of this feature request is to incorporate elevation / steepness into od2net's route cost. I don't have time to tackle this directly, so I'm going to try and break down the steps and be around to help.
Many many more notes at a-b-street/abstreet#82 from an older project |
I can have a look at this issue! |
Rosa pointed to https://github.com/U-Shift/Declives-RedeViaria/blob/main/SpeedSlopeFactor/SpeedSlopeFactor.md for how to use in cost functions |
I am looking at incorporating the steepness into the cost function now, but noticed the Edges do not directions attached (I could be wrong here). I am trying to think of a way to ensure the steepness is applied properly does anyone have any ideas? Extra context: Let me know if I have missed something or become misguided! |
Very good questions! Right now, od2net mostly ignores direction -- the final counts of trips crossing a road are in either direction, and cyclists can route either way on an existing one-way. #19 is open to fix these. For the second part, this will become a user's choice -- respect current one-ways or ignore them. When planning possible extensions to a cycling network, something that's one-way for all traffic right now could maybe become contraflow for cycling. There are many successful examples of this in the UK (and a paper demonstrating the safety of it). But I don't think we need to care about any of that here yet. od2net/od2net/src/network/mod.rs Line 19 in ee269f4
Edge is (node1, node2) . So you could add slope_factor to Edge and define it as going from node1 to node2. When you're calculating it for every edge, the two nodes in order are available -- an example is
Then the second part would be using the slope in one direction or another during routing. Right now calculate_batch is only taking |
Thank you, that makes sense. I will give passing in the node1 and node2 a go then! I will most likely check in again soon! |
anyone know where I can find |
https://play.abstreet.org/dev/data/input/shared/elevation/UK-dem-50m-4326.tif.gz |
@KDKasonde, some work requirements on my end have come up, and I might need to get this started before next week. I don't want to preempt or rush any work you've been doing though! I peeked around and found your branch, https://github.com/KDKasonde/od2net/tree/feature/dem_file_based_network_elevation, and it's looking pretty awesome! Any sense how far from a PR you are? Even if things are incomplete, I could start trying things out |
Hey sorry this definitely took longer than I thought it would😅 I think I am happy with getting the slope augmented cost, generating a network, and using the appropriate cost when doing the routing. What I am stuck on now is showing the cost (now stored as a tuple in the edge), slope and highlighting routes on the web app. Also turns out my issue Let me know if this was helpful I can go into more detail. |
No worries at all, it's quite a hefty "starter" project. For plumbing the new per-edge data to the frontend, check out od2net/od2net/src/network/output.rs Line 65 in 2a924d7
cost_forwards and cost_backwards property? Sending back a JSON array with 2 numbers should be possible too, but then using it over in MapLibre will be a bit funky, because array and nested object properties get squished down into a string in some of their APIs. (It's a really weird and subtle behavior that constantly messes me up.)
I'm curious what you have in mind for visualizing the steepness in the frontend. In another work project, I'm working on this too: acteng/atip#475. We could use the same ideas if they seem relevant |
Also, I'm realizing the code at od2net/od2net/src/network/output.rs Line 54 in 2a924d7
set_property API once you have a geojson::Feature . An example is https://github.com/dabreegster/ltn/blob/f5f321732d80a127534676559047dd94f7471449/backend/src/neighbourhood.rs#L133. We could make the geojson::Feature struct first with empty properties, then just call set_property and get rid of all the serde::to_value boilerplate
|
So that's why my tuples were string! Thank you I couldn't figure out why that was happening, I think I will go with what you have just said then, it makes sense and should be a quick change! For the steepness I won't lie I have not thought about it too deeply, but my initial thoughts were similar to how the LTS is done, getting the min and max slope, mapping this to a colour range and seeing how that would work out🤔 But not much thought on showing which direction the slope is for, really. |
https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/#queryrenderedfeatures And sounds good for visualization -- start simple, we can always make improvements later on |
Thanks for that link! Also when is your cut off date so I can keep it in mind? |
Saturday. I'll probably just clone your branch at that point and start from
there. It's for a hackathon in the middle of the week, so we can just use a
temporary branch that day if needed
…On Wed, Feb 21, 2024, 8:47 PM KDKasonde ***@***.***> wrote:
Thanks for that link! Also when is your cut off date so I can keep it in
mind?
—
Reply to this email directly, view it on GitHub
<#18 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAMWLF2XP2TMYQQXQF5FBRDYUZMONAVCNFSM6AAAAAA4KWIFSWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNJXHA4DGMBZGQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***
com>
|
Right okay, I can PR everything except the steepness visuals if that helps? |
Yep, that'll work. Thank you! And again, no need to rush on this, I can very much just clone from your branch if needed |
@KDKasonde, enabling this is pretty easy: 6f31e13 |
Which project is that? And is that because it is calculated edge by edge or they are not all calculated or something? |
Should I leave the visualisation to you then? |
It's hard to understand just because hovering over each edge and looking at the slope in the popup is tedious. The other project is https://acteng.github.io/atip/browse.html, "Other > Gradient" on the right. acteng/atip#475 is the frontend code I'm adapting now |
Yep, I'm sort of in a rush to get some things ready for next week. Thanks again a ton for getting this going -- a group is looking at the whole process of route network generation and analysis, and being able to influence route choice by slope makes od2net way more realistic for studying this |
Happy to help! I just hope I have not set you guys back! |
Possible reference, https://www.liedman.net/2015/04/13/add-elevation-data-to-osrm/
The text was updated successfully, but these errors were encountered: