Skip to content

fix: enable last intersection of last step before a via point - #3176

Merged
karussell merged 8 commits into
graphhopper:masterfrom
OlafFlebbeBosch:intersection
Aug 7, 2025
Merged

karussell merged 8 commits into
graphhopper:masterfrom
OlafFlebbeBosch:intersection

Conversation

@OlafFlebbeBosch

@OlafFlebbeBosch OlafFlebbeBosch commented Jul 4, 2025 •

Copy link
Copy Markdown
Contributor

We noticed that intersections are not populated on the arrival intersection on both OSRM and mapbox directions creating issues to pass VIA points in navigation.

  • rename instructionJson to stepJson, since it is about the step Json object
  • Adding an ManeuverType enum to better document the Maneuver we are going to create
  • Handle ManeuverTypes and TurnTypes differently, since they are different concepts, sharing some values but not all
  • Fix typo bearingsArray vs bearingsrray
  • rename isFirstInstructionOfLeg to isDepartInstruction and use maneuverType in the subroutines instead
  • rename fixFirstIntersectionDetail to fixDepartIntersectionDetail since intersections have to be fixed on every leg
  • fix one test setup and one test
    @boldtrn would you please have a look ?

@OlafFlebbeBosch OlafFlebbeBosch changed the title fix: enable last intersection of last step of via points fix: enable last intersection of last step before a via points Jul 4, 2025
@OlafFlebbeBosch OlafFlebbeBosch changed the title fix: enable last intersection of last step before a via points fix: enable last intersection of last step before a via point Jul 4, 2025

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.

The comments should be updated as well :)

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.

I don't like the name pos, can you rename this to something that explains what pos is?

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

I did setup this PR on a test server and tried to use the routing in combination with Maplibre-Navigation-Android. This worked fine as well, so we haven't broken anything here as well.

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

Sorry, I just found this issue that can occur in some situations when using Maplibre Navigation, this can lead to a nullpointer because the modifier is missing.

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

LGTM, just gave this another try with Maplibre after the latest change.

Olaf Flebbe and others added 6 commits July 22, 2025 09:50
@OlafFlebbeBosch

Copy link
Copy Markdown
Contributor Author

Rebased and fixed an edge case

@karussell karussell added this to the 11.0 milestone Jul 22, 2025
request.addPoint(new GHPoint(42.505144, 1.526113));
request.addPoint(new GHPoint(42.50529, 1.527218));
request.setProfile(profile);
request.setProfile(profile).setPathDetails(Collections.singletonList("intersection"));

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.

minor: can you check the formatting here and elsewhere in this file?

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.

done

@karussell
karussell merged commit 5b1f142 into graphhopper:master Aug 7, 2025
@karussell

karussell commented Aug 7, 2025 •

Copy link
Copy Markdown
Member

There is a now test failure in master. And if I change null to "straight":

assertEquals("straight", maneuver.get("modifier").asText());

it runs fine. Is this expected or did I something wrong when merging?

karussell added a commit that referenced this pull request Aug 7, 2025
@boldtrn

boldtrn commented Aug 7, 2025

Copy link
Copy Markdown
Member

There is a now test failure in master. And if I change null to "straight":

Actually depart usually has no modifier IIRC. I am not sure this will break anything, if there is a modifier - I would not expect it to (at least for Maplibre I would expect the impact to be rather low)

@OlafFlebbeBosch

Copy link
Copy Markdown
Contributor Author

Sorry, I am not sure why this slipped through. And agree to @boldtrn , it shouldn't have a modifier. Looking into why that happend

@karussell

karussell commented Aug 8, 2025 •

Copy link
Copy Markdown
Member

Hm, this is now just as it was before the merge of this PR:

assertEquals("straight", maneuver.get("modifier").asText());

@boldtrn

boldtrn commented Aug 8, 2025

Copy link
Copy Markdown
Member

Hm, this is now just as it was before the merge of this PR

Ah sorry, I must have missed this, OK, if we have always added a modifier here, then this is probably not an issue, so all good from my side then.

@oflebbe

oflebbe commented Aug 8, 2025

Copy link
Copy Markdown
Contributor

Looks like i introduced the change with a previous attempt fixing and somehow the test didnt trigger w/o a mvn clean on my side

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.

4 participants