Skip to content

Add encoded value for mountainbike route relation handling - #2904

Merged
karussell merged 4 commits into
graphhopper:masterfrom
ratrun:mtb_network
Nov 8, 2023
Merged

karussell merged 4 commits into
graphhopper:masterfrom
ratrun:mtb_network

Conversation

@ratrun

@ratrun ratrun commented Nov 3, 2023

Copy link
Copy Markdown
Contributor

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

ratrun commented Nov 3, 2023

Copy link
Copy Markdown
Contributor Author

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

@karussell karussell left a comment •

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

ratrun commented Nov 6, 2023

Copy link
Copy Markdown
Contributor Author

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?

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
Copy Markdown
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.

@ratrun ratrun Nov 7, 2023 •

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
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
Copy Markdown
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.

2 participants