feat: nav-5699 add pedestrian name enricher - #33
Conversation
dade867 to
c97296d
Compare
e96b57a to
8ed939b
Compare
bb375cd to
83467ec
Compare
8112508 to
1c6ea13
Compare
|
L'enrichissement des edges piétons a lieu juste après le build du graph et surtout avant le En effet, si on veut que ça soit une étape à la fin de la pipeline qui build les tiles, le paramètre Comme l'enrichissement des edges piétonnes a lieu avant le |
7022475 to
bcab98d
Compare
03fecd7 to
daec788
Compare
Enrich unnamed sidewalk edges with the name of the nearest street
Motivation
When Valhalla routes a pedestrian along a sidewalk/footway that has its own geometry, the narrative typically falls back to generic wording ("the walkway", "the path") because these OSM ways rarely carry a
name=*tag. Users expect to hear the name of the street the sidewalk runs along ("follow boulevard Saint-Germain"), not a generic "walkway".This is a recurring, well-documented pain point for pedestrian guidance:
is_sidepathfeaturesThe approaches discussed so far rely on OSM tags such as
is_sidepath:of:name=*orstreet:name=*to carry the parallel street's name. Those keys are valuable but still sparse (~30k ways worldwide foris_sidepath:of:name), so they only help where mappers have explicitly added them.This PR takes a complementary, tag-independent approach: it derives a street name geometrically at tile-build time, so unnamed sidewalk edges can get a meaningful name regardless of whether the sidepath tags are present. Where those tags do exist, they could later be used as an authoritative override on top of this heuristic.
What this PR does
Adds a new tile-build stage that runs after the graph is built and before
GraphEnhancer, enriching unnamed edges whose Valhalla use iskSidewalkwith the name of the closest matching named road edge, up to a maximum distance of 50 metres.Placing the stage before
GraphEnhanceris deliberate:name_consistency(the per-edge bitfield the enhancer computes to flag neighbouring edges sharing a name, used to penalise name changes during costing) is then computed with the enriched names taken into account, so the enrichment actually influences pedestrian routing/guidance rather than only the textual narrative.How it works
Each tile is processed by a worker thread in three phases:
Build an R-tree (
boost::geometry::index) indexing all named road edges of the tile. Named edges are sampled into points spaced at most 10 m apart and the points (not segments) are indexed for fast nearest-neighbour queries.For each unnamed sidewalk edge, query the ~100 nearest indexed points (coarse distance from the sidewalk edge centre), gather the candidate named edges, group them by candidate name, and score each name group by the finer average distance between the sidewalk edge and that group. Grouping by name handles the common case of a long sidewalk running along a road that is split into many short same-named edges.
Rewrite the tile's
EdgeInfoand recompute binary offsets for the newly named edges.Performance notes
loki::searchhere (~100x faster for this batch nearest-name workload;loki::searchis built for individual queries).floatinstead ofdoublein the R-tree gives a significant speedup.(lon, lat)is mapped to(lon * cos_lat, lat)withcos_lata constant computed from the tile-centre latitude.Full Île-de-France OSM extract near Paris, 40 tiles, 12 threads: ~360k enriched edges, ~70 s total. The dense central-Paris tile dominates (~260k enriched edges, ~50 s enrichment on a single thread), so moving from per-tile to per-edge parallelism is an obvious next win.
Known limitations / future work
kSidewalkedges. It could later be combined with the explicitis_sidepath:of:name/street:nametags from #5594 as an authoritative source when present.We'd welcome maintainer feedback on the approach and on where the community would prefer this to live in the pipeline.