-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Slope walking speed calculation is not accurate #2579
Comments
PR: #2580 |
|
There is a few things that I want to bring to peoples attentions - and that I think is open for discussion. For background information se the articles at the end of this comment.
Relevant information |
My opinion on the above questions is:
Formula: Where:
This is a small change to the existing PR (A bit of work to adjust the tests). The remaining question is then if there should be a cut off for for very steep slopes (pos/neg)? I think not, but there might be good reasons for it:
|
I'm completely in favor of replacing these cost functions in light of the comments in this ticket. However remember that output of the cost function will be compromised by the fact that the input slopes are not particularly accurate - they're often drawn from somewhat low resolution data sets, and even when the resolution is higher an OSM way may accidentally drape over a building or cliff edge in a DEM. |
Good point @abyrd. I have not looked into the code that calculate the slope - ideally there should be some sanity checks there. The cut-off will decrease the impact in such cases. Also, the Tobler function have less impact than the MTI, but slightly worse for Naismith when the slope is uphill > 23 degrees. (https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Hiking_speed.svg/2000px-Hiking_speed.svg.png) |
As you mentioned, @t2gran , there should probably be some cutoffs. I think what we tested was to cut off the walk cost multiplier at 3. Another point to discuss is what to do with negative slopes. Should walk speed increase, decrease or no change? |
@gmellemstrand I think we should do Tobler - which is defined for negative slopes, and yes implement a cut-off. I would preferere the cut-off to be tied to angle not cost. The reason is that if the horizontal speed changes, so does the cost. For a "fast" walker the cut-off would happen at let say 30 degrees, for a given kost, while it would happen at 32 degrees for a "slow" worker - that is probably not desirable. If the cut-off is configurable it can tuned to a reasonable value with regard to the data quality. |
I realize cost is not a very accurate term. It is really used as a walking distance multiplier, so in this case the cutoff would not be affected by walking speed. It would correspond to an angle. |
Good, so specifying the cut-off values as an angles (neg/pos) or a maximum walking distance multiplier (absolute value) is more or less equivalent. Maybe the OTP should log an info message at startup with both the maximum walking distance multiplier and witch angle this occur at. |
I think we could do that. Use the Tobler function and have parameters for the minimum and maximum multiplier (as well as the corresponding slope angles reported by OTP at startup). I imagine not everyone would want walk speed to increase beyond the set speed because of negative slopes, so the minimum cutoff multiplier could default to 1. |
I did some testing with these changes. With Helsinki metropolitan area OSM data and 10m grid DEM data, the average walk speed went up from 1.10 m/s to 1.46 m/s. I set the walkSpeed to be 1.222 (m/s) in requests. Sample size was 2000 requests. I think the speed should be on average less or equal to the set walkSpeed on even a medium sample size. There are some cases where it would make sense that individual requests would have faster walk speed because of downhill but on average It seems illogical that the actual walk speed would be higher than the requested walk speed. |
Tank you for testing this - Yes, and increase in walk speed is not expected, because of the exponential nature of this function you should se a small decrease in speed. We will look into this. |
@optionsome There was a bug in the walkingDistance calculation witch resulted in all walkingDistances to be only 0.75 of the expected. We have provided a new commit with a fix. |
Thanks for the quick update. Redid the tests and got 1.15 m/s with the aforementioned test case which is slightly higher than it used to be but in the realm of reality now. Also did some tests with different walkSpeeds and the requested speed vs "actual" speed seemed to scale similarly as before these changes. For example, with 3.666 m/s as the requested speed, I got 3.21 m/s with these changes and 3.07 m/s without them. Haven't done thorough code review but with a quick look the code changed seemed to be ok as well. |
@optionsome, tank you for testing this. In the past we have split the review tasks among the reviewers, so if @abyrd do the code review and you have done testing, that is perfectly fine. I don´t find anyone from HSL on the review list, I will follow up on that and maybe we can include some of the HSL developers. |
Changed calculation of slope costs (#2579)
Resolved via PR #2580 |
The current rule for slope calculation does not seem to be usable. Costs do not make sense, and positive and negative slopes are treated the same.
We have proposed a new way to calculate slope costs, that center around -8% slope (fastest) and then increases exponentially for both positive and negative slopes around this point.
EDIT: The linked pull request uses a simpler exponential algorithm with has cutoffs at 1.0 (for neutral and negative slopes) and 3.
The text was updated successfully, but these errors were encountered: