From 0aa17370dd4ced0308f6e7bb2eb3c87f0c9fc1e4 Mon Sep 17 00:00:00 2001 From: jarinox <45308098+jarinox@users.noreply.github.com> Date: Mon, 10 Nov 2025 12:47:51 +0100 Subject: [PATCH 1/2] fix: use separate instructions for roundabout and following road segment --- .../java/com/graphhopper/routing/InstructionsFromEdges.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/src/main/java/com/graphhopper/routing/InstructionsFromEdges.java b/core/src/main/java/com/graphhopper/routing/InstructionsFromEdges.java index 9438e0e9ee5..57417712481 100644 --- a/core/src/main/java/com/graphhopper/routing/InstructionsFromEdges.java +++ b/core/src/main/java/com/graphhopper/routing/InstructionsFromEdges.java @@ -255,6 +255,11 @@ public void next(EdgeIteratorState edge, int index, int prevEdgeId) { .setDirOfRotation(deltaOut) .setExited(); + // ORS-GH MOD START - additional instruction after exiting roundabout + prevInstruction = new Instruction(Instruction.CONTINUE_ON_STREET, name, new PointList(10, nodeAccess.is3D())); + ways.add(prevInstruction); + // ORS-GH MOD END + prevInstructionName = prevName; prevName = name; From b21de99119fb8e99ed8f065eeae73a108dfdfb0d Mon Sep 17 00:00:00 2001 From: jarinox <45308098+jarinox@users.noreply.github.com> Date: Tue, 11 Nov 2025 11:22:59 +0100 Subject: [PATCH 2/2] test: additional instruction after exiting roundabout --- core/src/test/java/com/graphhopper/GraphHopperTest.java | 6 +++--- core/src/test/java/com/graphhopper/routing/PathTest.java | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/com/graphhopper/GraphHopperTest.java b/core/src/test/java/com/graphhopper/GraphHopperTest.java index 6bcc4759762..517e763bc96 100644 --- a/core/src/test/java/com/graphhopper/GraphHopperTest.java +++ b/core/src/test/java/com/graphhopper/GraphHopperTest.java @@ -198,14 +198,14 @@ public void withoutInstructions() { // no simplification hopper.getRouterConfig().setSimplifyResponse(false); GHResponse routeRsp = hopper.route(request); - assertEquals(10, routeRsp.getBest().getInstructions().size()); + assertEquals(11, routeRsp.getBest().getInstructions().size()); assertEquals(43, routeRsp.getBest().getPoints().size()); // with simplification hopper.getRouterConfig().setSimplifyResponse(true); routeRsp = hopper.route(request); - assertEquals(10, routeRsp.getBest().getInstructions().size()); - assertEquals(39, routeRsp.getBest().getPoints().size()); + assertEquals(11, routeRsp.getBest().getInstructions().size()); + assertEquals(41, routeRsp.getBest().getPoints().size()); // no instructions request.getHints().putObject("instructions", false); diff --git a/core/src/test/java/com/graphhopper/routing/PathTest.java b/core/src/test/java/com/graphhopper/routing/PathTest.java index 0a16d32ca1d..e629bb19c2d 100644 --- a/core/src/test/java/com/graphhopper/routing/PathTest.java +++ b/core/src/test/java/com/graphhopper/routing/PathTest.java @@ -235,6 +235,7 @@ public void testCalcInstructionsRoundabout() { List tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("continue onto MainStreet 1 2", "At roundabout, take exit 3 onto 5-8", + "continue onto 5-8", "arrive at destination"), tmpList); // Test Radian @@ -249,6 +250,7 @@ public void testCalcInstructionsRoundabout() { tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("continue onto MainStreet 1 2", "At roundabout, take exit 2 onto MainStreet 4 7", + "continue onto MainStreet 4 7", "arrive at destination"), tmpList); // Test Radian @@ -267,6 +269,7 @@ public void testCalcInstructionsRoundaboutBegin() { InstructionList wayList = InstructionsFromEdges.calcInstructions(p, p.graph, weighting, mixedEncoders, tr); List tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("At roundabout, take exit 3 onto 5-8", + "continue onto 5-8", "arrive at destination"), tmpList); } @@ -282,6 +285,7 @@ public void testCalcInstructionsRoundaboutDirectExit() { List tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("continue onto 3-6", "At roundabout, take exit 3 onto 5-8", + "continue onto 5-8", "arrive at destination"), tmpList); roundaboutGraph.inverse3to9(); @@ -473,6 +477,7 @@ public void testCalcInstructionsRoundabout2() { List tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("continue onto MainStreet 1 2", "At roundabout, take exit 2 onto 5-8", + "continue onto 5-8", "arrive at destination"), tmpList); // Test Radian @@ -552,6 +557,7 @@ public void testCalcInstructionsRoundaboutIssue353() { InstructionList wayList = InstructionsFromEdges.calcInstructions(p, p.graph, weighting, carManager, tr); List tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("At roundabout, take exit 1 onto MainStreet 1 11", + "continue onto MainStreet 1 11", "arrive at destination"), tmpList); } @@ -567,6 +573,7 @@ public void testCalcInstructionsRoundaboutClockwise() { List tmpList = getTurnDescriptions(wayList); assertEquals(Arrays.asList("continue onto MainStreet 1 2", "At roundabout, take exit 1 onto 5-8", + "continue onto 5-8", "arrive at destination"), tmpList); // Test Radian