Skip to content

fix #3337 (instructions): propagate major road names for unnamed link instructions #3338

Merged
michaz merged 1 commit intographhopper:masterfrom
gulbalasalamov:fix/unnamed-link-names-in-instruction-steps
Apr 9, 2026
Merged

fix #3337 (instructions): propagate major road names for unnamed link instructions #3338
michaz merged 1 commit intographhopper:masterfrom
gulbalasalamov:fix/unnamed-link-names-in-instruction-steps

Conversation

@gulbalasalamov
Copy link
Copy Markdown
Contributor

Fixes #3337

Summary

This PR fixes missing road names for instructions that start on unnamed link roads and continue onto named major roads.

Previously, GraphHopper could generate instructions like:

  • Turn left

even though the merged instruction actually continued onto a named road such as:

  • Purple Heart Trail (I-40)

Root cause

The unnamed link and following major road were merged into a single instruction, but the major road name/ref was not propagated into the merged instruction.

Fix

Instead of guessing from neighboring graph edges, this change performs deferred name fallback on the actual routed continuation:

  • if an instruction starts on an unnamed link road,
  • and the next edges remain part of the same instruction,
  • and a named non-link major road is encountered,
  • the instruction name is updated using that road's name/ref.

To avoid regressions for motorway destination-style instructions, the fallback is not applied when the instruction already carries destination-related information.

Result

The instruction now changes from:

  • Turn left

to:

  • Turn left onto Purple Heart Trail (I-40)

for this class of cases.

Testing

  • Added a regression test in InstructionListTest for unnamed link -> named major road instruction generation.
  • Verified the change with local test runs, including a full successful Maven build/test run.

@gulbalasalamov gulbalasalamov changed the title fix(instructions): propagate major road names for unnamed link instructions fix #3337 (instructions): propagate major road names for unnamed link instructions Apr 7, 2026
Copy link
Copy Markdown
Member

@michaz michaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@michaz michaz merged commit 407da45 into graphhopper:master Apr 9, 2026
michaz added a commit that referenced this pull request Apr 9, 2026
…l other instructions

- Remove buildRoadLabel() — set instruction name to just the street name, not a composite
  "Name (Ref)". The ref is already stored in STREET_REF and used by _getName() for display.
- Remove duplicate setExtraInfo(STREET_REF, ref) that was immediately overwritten.
- Update test to assert name and ref separately.

Follows up on #3338.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@karussell karussell added this to the 12.0 milestone Apr 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Merged instruction loses main road name when unnamed *_link continues onto named major road

3 participants