Skip to content

Use road class to determine if a fork should have an instruction - #1844

Merged
karussell merged 6 commits into
graphhopper:masterfrom
boldtrn:issue_990_2
Jan 10, 2020
Merged

karussell merged 6 commits into
graphhopper:masterfrom
boldtrn:issue_990_2

Conversation

@boldtrn

@boldtrn boldtrn commented Dec 31, 2019 •

Copy link
Copy Markdown
Member

This PR solves #990 and #1047.

Essentially, this will remove many unnecessary instructions on main roads, including the annoying continue instructions on motorways. For minor roads the difference should be rather small.

Something I am not sure about is how we should handle the tagged maxspeed. Often no maxspeed is tagged. Currently I decided to fallback to the average speed.

Let me know how this works out in your tests and if there are any cases we need to improve.

Here is a brief comparison of GH maps route vs. the improved version, I think the difference is quite visible :)):
Screenshot from 2019-12-31 16-14-30
Screenshot from 2019-12-31 16-14-36

BTW: I stumbled over #1843 while creating this PR

@karussell karussell added this to the 1.0 milestone Jan 1, 2020
@boldtrn

boldtrn commented Jan 3, 2020

Copy link
Copy Markdown
Member Author

Due to the recent fix in #1845 this is working fine now. WDYT? Do we need to add anything here?

@boldtrn
boldtrn requested a review from karussell January 3, 2020 06:56

@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.

Thanks, looks good :)

Only one minor thing.

@karussell
karussell merged commit 58681ee into graphhopper:master Jan 10, 2020
@karussell

Copy link
Copy Markdown
Member

In the following situation the second continue instruction is removed (see MapMatchingTest.testDoWork):

http://localhost:8989/maps/?point=51.331131%2C12.379956&point=51.330293%2C12.38149

So, before there were 2 instructions: "continue onto Windmühlenstraße" and "continue onto Bayrischer Platz" and now there is just the first instruction. This is an improvement IMO as the road name changes on a non-junction node and so the instruction is unnecessary.

But could there be instructions removed due to this PR although the road name changes directly on a junctions? Personally I would prefer to keep these instructions to make navigation clear in a dense area.

@boldtrn boldtrn left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

But could there be instructions removed due to this PR although the road name changes directly on a junctions?

Yes this could happen in some rare scenarios.

Our, "most complicated" case to decide if an instruction is needed or not is at a potential fork. A potential fork is an intersection where at least two roads more or less continue in the same direction as the previous road. Before, if just a minor attribute changed between the previous and the current edge, we created an instruction. Therefore, we have seen so many instructions on motorways.

One indication that we need an instruction at a fork, is a changing road name. This approach doesn't work well on motorways for example, because often all edges have the same name. On rural roads, often the short edges between two linking roads don't have a name attached (or miss the maxspeed tag, etc.), which also leads to undesired instructions.

So essentially one of the changes in this PR is to check the road class. If the current road is a main road ((roadClass == RoadClass.MOTORWAY || roadClass == RoadClass.TRUNK || roadClass == RoadClass.PRIMARY || roadClass == RoadClass.SECONDARY || roadClass == RoadClass.TERTIARY)), and we are staying on the same road class, where the other road is a different road class (including _link), then we very likely don't need an instruction.

There are certainly edge cases when this approach does not work.

Personally I would prefer to keep these instructions to make navigation clear in a dense area.

In my opinion, we should only provide an instruction if the user has to change something, like turning, switching lanes, etc., if the user only needs to follow the road, no instruction should be provided. Especially in dense areas, if you tell a user to "continue on street a", the user will start to look for street signs with "street a". Finding street signs can be quite hard sometimes and removes attention from the important task of driving.

@karussell

Copy link
Copy Markdown
Member

In my opinion, we should only provide an instruction if the user has to change something, like turning, switching lanes,

Yes, in theory I agree. The problem in practice is that often junctions are not perfectly mapped and so omitting continue instructions for the inner-city case could be problematic if the road name changes. But we'll see what feedback we'll get. Just wanted to understand the now failing map matching test and will now just adapt to the new instructions.

@boldtrn

boldtrn commented Jan 13, 2020

Copy link
Copy Markdown
Member Author

Yes that makes perfect sense :). Let's see what people think. Unfortunately in the real world there are so many different scenarios and you cannot easily test them without knowing the actual situation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants