Urban-Analytics-Technology-Platform / od2net

https://od2net.org
Apache License 2.0
28 stars 6 forks source link

Add elevation to routing evaluations #59

Closed KDKasonde closed 6 months ago

KDKasonde commented 6 months ago

Objective This PR aims to tackle issue #18 with the omission of allowing end users to toggle edge colouring by steepness.

Changes Config will now accept a dem attribute which is the location of the tif file users want to extract elevations from, but this is all optional.

The Edge struct now has the new attributes:

The steepness is used when doing batch calculations in the calculate_batch function which returns an option tuple of costs now.

For now the forward and backward costs are calculated by multiplying a base cost by the slope_factor. For more details see here.

Breaking changes Users with external commands need to edit them to make sure they output a tuple of costs not a float now as a result of the changes.

KDKasonde commented 6 months ago

Thanks so much for this! It's a very impressive first PR in Rust. How has learning the language been so far?

A bunch of comments, mostly Rust style stuff. Let me know if anything's unclear (or if you don't have time to address them). And could you please run cargo fmt to auto-format everything?

Cheers man it is very fun to learn, definitely think reading the book first helped me out ALOT, but I still have a lot of trouble with the different pointers it uses and the traits system - I probably suck at design if it is in Rust. I am also slower when using it, but also much more thoughtful with what I am writing so I consider that a win. I will carry on using it, just because it is a very nice language.

And sweet I will look through the changes and makes some updates now!

KDKasonde commented 6 months ago

Thanks for the comments btw they were really helpful! Also for the examples, how will you add the geotiff file?

dabreegster commented 6 months ago

I'll change the setup.py scripts to download the file, probably.

I'll open a PR and CC you on any changes I make tomorrow

KDKasonde commented 6 months ago

I'll change the setup.py scripts to download the file, probably.

I'll open a PR and CC you on any changes I make tomorrow

Please do man!