Skip to content
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

Add encoded value for mountainbike route relation handling #2904

Merged
merged 4 commits into from Nov 8, 2023

Conversation

ratrun
Copy link
Contributor

@ratrun ratrun commented Nov 3, 2023

Triggered by a user request in https://discuss.graphhopper.com/t/mtb-network-is-missing/8259/2 I implemented support for mountainbike relation handling in this PR

@ratrun
Copy link
Contributor Author

ratrun commented Nov 3, 2023

I used the following way as a real-world testcase: https://www.openstreetmap.org/way/169096949. It is part of a regional bike relation and of two mountainbike relations:

image

@ratrun ratrun marked this pull request as ready for review November 3, 2023 15:17
Copy link
Member

@karussell karussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I understand it correctly that mtb_network is introduced but not used for the mtb parsers?

Couldn't we omit the mtb_network handling in the parser but create a custom model mtb.json and use this with mtb_network and bike_network? Or even better try to get rid of mtb parsers completely so that we only have a custom model? Shall I try this and propose a change?


import com.graphhopper.routing.ev.RouteNetwork;

public class BikeNetworkParser {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you move the determine method into OSMBikeNetworkTagParser? (Or rename this to BikeNetworkParserHelper as I would avoid the "Parser" naming here as it does not implement TagParser)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I choose to rename it into BikeNetworkParserHelper as suggested

@ratrun
Copy link
Contributor Author

ratrun commented Nov 6, 2023

Do I understand it correctly that mtb_network is introduced but not used for the mtb parsers?

Yes. Usage is supposed to be in a custom model. I tested with
priority: [{ if: 'mtb_network == MISSING', multiply_by: '0.5' }],

Couldn't we omit the mtb_network handling in the parser but create a custom model mtb.json and use this with mtb_network and bike_network? Or even better try to get rid of mtb parsers completely so that we only have a custom model? Shall I try this and propose a change?

As I do not quite understand what you mean and I don't see the relation to the PR I would ask for a proposal. Isn't this something unrelated?

@@ -15,16 +15,16 @@ public class MountainBikePriorityParser extends BikeCommonPriorityParser {
public MountainBikePriorityParser(EncodedValueLookup lookup, PMap properties) {
this(lookup.getDecimalEncodedValue(VehicleSpeed.key(properties.getString("name", "mtb"))),
lookup.getDecimalEncodedValue(VehiclePriority.key(properties.getString("name", "mtb"))),
lookup.getEnumEncodedValue(BikeNetwork.KEY, RouteNetwork.class));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Usage is supposed to be in a custom model.

But have a look into this change. Shouldn't we keep using BikeNetwork here then? Otherwise normal (and more frequent) route=bicycle tags will be ignored.

Copy link
Contributor Author

@ratrun ratrun Nov 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you ask I agree. I was unsure about it when writing this line. But it makes sense to keep the current behaviour in regards of prioritization for the more frequent route=bicycle tags. I changed it in the PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for your explanation! Can you also revert the change in MountainBikePriorityParser or is this somehow required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, I forgot that. Now I reverted the network priority changes in MountainBikePriorityParser.

@karussell karussell merged commit b53d8e7 into graphhopper:master Nov 8, 2023
@karussell karussell added this to the 9.0 milestone Nov 8, 2023
@karussell karussell added the osm label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants