Skip to content

Show instructions for turns onto oneway streets - #1281

Merged
karussell merged 7 commits into
graphhopper:masterfrom
boldtrn:issue_1048
Mar 2, 2018
Merged

karussell merged 7 commits into
graphhopper:masterfrom
boldtrn:issue_1048

Conversation

@boldtrn

@boldtrn boldtrn commented Feb 8, 2018

Copy link
Copy Markdown
Member

Fixes #1048.

The idea of this PR is that we show an instruction, even if the turn is the only viable turn, if there is another potential (but forbidden) turn and if the turn is not a "follow road/slight turn".

The idea is that we don't see instructions when entering motorways, because these turns are usually only slight turns, but that we see instructions when turning onto a separated lane oneway as described in #1048.

One situation would be this, but there are plenty.

So far the cases I looked at, look good. So far it feels like a good improvement. But I didn't perform too many tests yet.

@Test
public void testAlternativeRoute() {
// https://graphhopper.com/maps/?point=52.044124%2C10.378346&point=52.043847%2C10.381994&algorithm=alternative_route&ch.disable=true
// https://graphhopper.com/maps/?point=52.044098%2C10.378368&point=52.043847%2C10.381994&algorithm=alternative_route&ch.disable=true

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.

Here the server did not produce alternative routes anymore, I had to move the waypoint a couple of meters.

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.

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.

Mhm, maybe it was a one time issue? Should I revert the change?

@boldtrn boldtrn Feb 12, 2018 •

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.

I checked it on GH Maps before changing it and it didn't produce an alternative route. Now it seems to produce alternatives again.

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.

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.

This is weird as it is okay, when I run it locally.

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, when rerunning the failing jobs now they become green, i.e. they failed temporary due to some data update.

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.

Yes I had the same impression :). Should I revert this change as it doesn't really belong into this 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

/**
* Calculates the Number of surrounding edges, including the current turn.
* This includes oneways in the wrong direction that are no possible turn.
*/

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.

Hmmh, I do not understand this comment.

Is it like this:

Calculates the number of possible edges, including the edge of the current turn and oneway edges in the wrong direction that are not possible.

To highlight the similarity to the other method should this be named getAllEdges() and the other above getPossibleEdges() or something?

BTW: here is minor typo: https://github.com/boldtrn/graphhopper/blob/0bec92c40d395adbf1c8781a64dacf74b3868521/core/src/main/java/com/graphhopper/routing/InstructionsSurroundingEdges.java#L32

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.

Hmmh, I do not understand this comment.

Yes the comment is actually a bit complicated, we should find an easier description.

and the other above getPossibleEdges() or something?

I think possibleTurns is a good name, I think possibleEdges is harder to understand?

getAllEdges()

Yes that's a hard decision. It's not really allEdges.

         X
          |
         \/
A --> B --> C

For the route from A->B->C, possible turns would contain, B->C, because it's the only possible turn.

SurroundingEdges would contain B->X and B->C, but not A->B, so it's not really allEdges. But I agree surroundingEdges is not a good name either.

BTW: here is minor typo

Thanks for the hint, will fix it.

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.

For me "turns" is not really defined and if I think about a definition it will be combination of start and destination edge and then possibleTurns is not correct and should be possibleEdges

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.

You are right, it makes reading the code of the instruction generation a bit better understandable I think, but it's not really defined. How about outgoingEdges?

Now we need a way to differentiate the two cases like allowed/passable/traversableOutgoingEdges and allOutgoingEdges? I struggle a bit with possibleEdges, I don't think it describes the situation well enough to understand it without reading the documentation (the same was true for surrounding edges ;)).

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.

all and allowedOutgoingEdges sounds good. And yes surrounding edges is also unclear. But naming is really hard :)

@boldtrn

boldtrn commented Feb 12, 2018

Copy link
Copy Markdown
Member Author

I updated the comments and also added an example in the head comment of the class.

@karussell karussell added this to the 0.10 milestone Mar 1, 2018
@karussell
karussell merged commit 91b77f6 into graphhopper:master Mar 2, 2018
@karussell

Copy link
Copy Markdown
Member

Thanks!

@boldtrn
boldtrn deleted the issue_1048 branch March 4, 2018 03:34
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