diff --git a/lib/mosaic-routing/src/main/java/org/eclipse/mosaic/lib/routing/graphhopper/GraphHopperRouting.java b/lib/mosaic-routing/src/main/java/org/eclipse/mosaic/lib/routing/graphhopper/GraphHopperRouting.java index 87788f781..9c4ed0a02 100644 --- a/lib/mosaic-routing/src/main/java/org/eclipse/mosaic/lib/routing/graphhopper/GraphHopperRouting.java +++ b/lib/mosaic-routing/src/main/java/org/eclipse/mosaic/lib/routing/graphhopper/GraphHopperRouting.java @@ -375,6 +375,11 @@ private CandidateRoute convertPath(Graph graph, Path newPath, RoutingPosition ta EdgeIteratorState origEdge = edgesIt.next(); EdgeIteratorState currEdge = origEdge; + /* + * If the requested source or target point is in the middle of the road, an artificial node + * (and artificial edges) is created in the QueryGraph. As a consequence, the first + * and/or last edge of the route might be such virtual edge, which must be converted to its original edge. + */ if (currEdge instanceof VirtualEdgeIteratorState) { currEdge = graph.getEdgeIteratorStateForKey(((VirtualEdgeIteratorState) origEdge).getOriginalEdgeKey()); }