-
Notifications
You must be signed in to change notification settings - Fork 144
trekking: add whether there is a usable cycleway in the isbike bike hint #838
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
Conversation
85b294f to
aebd786
Compare
aebd786 to
f7d26d2
Compare
|
The build process delivers an error: Please try a |
|
Hello @afischerdev, thank you for your comment. I have been trying to setup the build environment with gradle on my end, but I stopped trying because for each error I corrected when launched the build, I got a new one, and that was starting to take much more time than I could afford! So, I focused on the error from the automated build instead. First, it says Then as the error is: Here is the test method: @Test
public void overrideParam() {
RoutingContext rctx = new RoutingContext();
rctx.keyValues = new HashMap<>();
rctx.keyValues.put("avoid_unsafe", "1.0");
String msg = calcRoute(8.723037, 50.000491, 8.712737, 50.002899, "paramTrack", rctx);
Assert.assertNull("routing failed: " + msg, msg);
File trackFile = new File(workingDir, "paramTrack1.gpx");
trackFile.deleteOnExit();
Assert.assertTrue("result content mismatch", trackFile.exists());
}Line 52 matches the last instruction (using As the name of the file name However, when I test the trekking profile from master and the trekking profile from this PR in brouter-web using the same from and to points as in the test, I get the same route result every time with the two trekking profile versions, even for original, 1st, 2nd and 3rd alternatives, and even when I enable Also, I noticed none of the calculated routes from my tests are the same as the This is And this is the computed route, original, with At this point, I may try to modify this PR, reverting my edits, just to re-run the tests to see if the problem happens with an untouched master... Can you help me understand what is going on here? That would be appreciated! EDIT: I tried to change a few things in the PR, but the test still fails. :( |
1dd19c9 to
f7d26d2
Compare
1879432 to
bd9083e
Compare
|
@zod could you give me a quick hand and explain how this test works (as you set it up), so that I can get why it fails here? 🙏 EDIT: Even changing I just don't get it... |
7426a4c to
bd9083e
Compare
|
I had the same problems when testing with this profile - - without inspecting the source. In my eyes the test tries to verify if BRouter is able to generate an alternative route. A different route will be generated than shown above, but the test is valid if another route is found. |
That sounds OK to me! I may try it here, or you can go first, because I am not sure I can have a look at it this week. EDIT: ok, I just changed the test as you suggested. |
|
@afischerdev Tests are working now! You / mainteners may consider merging 😛. Do you want an issue for each PR? |
Let's wait a little longer, maybe someone else would like to comment.
No, not for me. Sorry, one more comment: |
@afischerdev So I did some tests :
As I see it, the test purpose is to ensure that the parameter overriding is indeed working. So I changed the test code accordingly :
I will now rebase/change the commit history to make it more clean. |
In Germany, the tag is present over 92000 times. Indeed, other European countries have it much less often.
Yes, and we could consider cycleroutes relations for When you wrote that the I don't see/understand a specific problem here. About removing Any other opinion is welcomed! |
eb2a8cd to
01c8529
Compare
Linking to commit and then force pushing your changes leads to links which point nowhere, so I can't really check your changes. I'm not really proud of the test but I'll explain it anyways. If BRouter finds an existing track ( I think it's sensible to get rid of the reference file and not rely on this behavior. |
Sorry for that! Trying to keep a clean commit history for merging. But also trying to keep the current diff to master meaningful. Also, thank you for the explanation of the test case.
I didn't know this, thanks.
That's exactly how I ended up doing it. Compute a route without the parameter, then with the parameter, and ensure that we did not get an alternative route the second time (which would mean our parameter had no impact on the routing result). |
|
To conclude this PR, we should return to the beginning:
We had something like this code before: Note: The trekking.brf (from your other PRs) has changed in the meantime. So please check which version you want.
You could close this and add a new PR that is clean and has passed |
|
Thank you for your answer @afischerdev ! And thanks for merging the other PRs.
Just like zod (who wrote "I think it's sensible to get rid of the reference file and not rely on this behavior"), I also prefer an option like the second one (removing the need for a static result track file). However, I don't understand the logic of your proposal. If we "generate the first and second routes with the same parameters", how can they "both produce an alternative track"? If we do the exact same routing twice, I think that it will produce one route the first time, and an alternative route the second time. Can you please explain what you mean? Maybe we have a different understanding on the
In my PR, I check if what I describe in the second point actually happens. Is that not what we want?
Agreed. The new branch is already ready, I'm just waiting for your answer to my comment above before creating the PR. |
That may be poor wording, but you understand the situation correctly.
May be bad wordring too. But here, your understanding doesn't match what the test is intended to do. |
@afischerdev (or @zod ?) sorry, it is still a bit confused for me, can you just say quickly, what is the purpose or goal of the I mean, it is testing that some functionality (or use case) is working as expected, but which functionality exactly? |
or
|
|
Hello @afischerdev, please excuse by later answer. Purpose?You answer by saying what the test does (how it works). This is not saying what its purpose is. Example: what is the purpose of this car? It burns fuel and transform it to a rotation movement in a wheel. No, it's purpose is to travel pretty fast while carrying heavy loads, compare to walking. Here are the purposes I think this test has:
You suggest
=> This only work for purpose 1. I suggest (option A):
=> I think this works for purpose 1 and 2. Downside: we don't know if generating an alternative route would work. This could be done by doing step 2 again after step 3 and check if an alternative is generated (option B). QuestionDo you agree to go for option A or B? Thanks! |
|
@Totorrr Feel free to change the function name or add a description. Use something like the above code. |
|
Hello @afischerdev, I fail to see how option B can be realised with 2 steps, and how the above code ensures that purpose 2 is fulfilled. That being said, I created a new PR #852, in which I use the code you mention, with a few added comments. What do you think about merging that one, and closing this one? Thanks! |
I was focused to this statement: "... This could be done by doing step 2 again after step 3 ..." and wanted to point out that the first step (generation with default parameters) is not necessary.
Yes, that is the way. |
In the code you mentioned, just to check my hypothesis, I just replaced this: rctx.keyValues.put("avoid_unsafe", "1.0");by that: rctx.keyValues.put("peanut_chocolate", "1.0");on both lines, and the test is successful. I think it demonstrates that purpose 2 is not fulfilled by this code. |
|
@Totorrr |
I don't. I'm just saying that purpose 2 is not fulfilled by this code. Even if I do have a parameter named That being said, I vote for merging this as is, and for discussing further improvements of this test function in another PR. |
|
Ok, that is a fine idea. |


Some cycleways are not always properly detected, because some tagging schemes are not as straightforward as having
bicycle=yesdefined on the way. Theisbikebike hint we use would be closer to reality, and thus offering better routing, if we'd consider some more complicated tagging schemes, like "is there a usable cycleway on this road?".This patch is an attempt to do so with a single block of code.
This has the benefit of not messing too much with the existing code, with the downside of not being perfectly integrated within the profile.