Repository navigation
smoother elevation for tunnels and bridges - #3362
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a new preprocessing step for elevation handling at bridge/tunnel/ferry endpoints (“tower” nodes) to reduce slope artifacts at structure entries/exits by correcting tower elevations from nearby ground-road samples before running the existing structure interpolation.
Changes:
- Add
BridgeTunnelTowerCorrectionto adjust structure-touching tower elevations using nearby non-structure road samples and then re-interpolate adjacent ramp pillars. - Run the new correction step before existing bridge/tunnel/ferry interpolation in
GraphHopper.interpolateBridgesTunnelsAndFerries(). - Update/add tests and expected routing/elevation assertions to reflect the new elevation behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| core/src/main/java/com/graphhopper/reader/dem/BridgeTunnelTowerCorrection.java | New elevation correction pass for structure endpoint (“tower”) nodes and adjacent ramp pillars |
| core/src/main/java/com/graphhopper/GraphHopper.java | Integrates tower correction step into the elevation interpolation pipeline and updates timing log |
| core/src/main/java/com/graphhopper/reader/dem/EdgeElevationInterpolator.java | Renames method to clarify it interpolates inner tower nodes |
| core/src/test/java/com/graphhopper/reader/dem/BridgeTunnelTowerCorrectionTest.java | New unit tests for tower correction + ramp pillar re-interpolation behavior |
| core/src/test/java/com/graphhopper/GraphHopperTest.java | Updates expected distances/point elevations/ascend-descend values impacted by new correction |
| core/src/test/java/com/graphhopper/routing/RoutingAlgorithmWithOSMTest.java | Updates expected route distances affected by changed elevation processing |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Use a priority queue ordered by accumulated distance instead of a FIFO queue so that distFromStart always holds the true shortest-path distance to each node. This ensures: - IDW weights are based on the nearest approach, not an arbitrary traversal-order distance - The BFS_MAX_DIST_M budget cutoff correctly includes all nodes reachable within 50 m via any path, not just the first-discovered path Also rename bfsCollectRoadSamples -> dijkstraCollectRoadSamples and update comments/Javadoc throughout.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The elevation for the "entry nodes" of a bridge (or tunnel or ferry) is often disturbed because the elevation data already starts deviating from the true road level before the OSM bridge tag begins. And so the tower node needs some lifting, including the neighboring ramp. AI helped me implementing 3 different approaches and I picked this one because of its simplicity and overall good results.
There are several examples:
tunnel-bridge complex in Cotta (before/after)

Bähnle-Radweg bridge (before/after):

Thiergarten tunnel (before/after):

Neudorf bridge (before/after):

An inclined bridge in Daun also works (before/after):

Tricky bridge structure for Marienbrücke and although total incline/decline stays the same you see that it got smoother:

Another bridge structure with multiple parallel ways

Similar improvements for motorway bridges

Unsolved challenges: