Skip to content

Traffic signs: build script, POI picker, map overlay#13

Draft
tordans wants to merge 1 commit into
masterfrom
cursor/traffic-signs-b8de
Draft

Traffic signs: build script, POI picker, map overlay#13
tordans wants to merge 1 commit into
masterfrom
cursor/traffic-signs-b8de

Conversation

@tordans
Copy link
Copy Markdown
Owner

@tordans tordans commented May 31, 2026

Problem (user story)

As an OpenStreetMap mapper surveying roads in Germany, I want to add and review traffic_sign tags without memorizing StVO codes or the exact DE: / ; / , composition rules, so that I can tag signs accurately and see them on the map while editing.

Acceptance criteria

  • When the map country has a traffic-sign catalog (initially DE), POI fields traffic_sign, traffic_sign:forward, and traffic_sign:backward show a + control that opens a searchable sign picker.
  • The picker supports multi-select, frequently-used defaults on empty search, compose on apply, and decompose on open while preserving unrecognized fragments as “other” chips.
  • A display setting Show Traffic Signs draws compact sign chains on nodes and ways (with directional tag handling).
  • A prep script (src/traffic-signs/update.sh) bundles index metadata and SVG assets from @osm-traffic-signs/converter, wired into src/update_all.sh.

Implementation notes (by Cursor)

Build pipeline (src/traffic-signs/)

  • update.sh / build_index.mjs: runs npm install and consumes @osm-traffic-signs/converter to emit:
    • TrafficSignIndex.json — per-country entries, search tokens, redirect map, frequently-used list, named values
    • TrafficSigns.xcassets — 202 DE SVG imagesets (vector-preserving)
  • Hooked into src/update_all.sh alongside presets and POI icons.

Runtime (Swift)

  • TrafficSignCatalog / TrafficSignComposer: load bundled index; offline compose/decompose aligned with package rules (DE: prefix, ; between signs, , within compound signs, redirects, named values).
  • TrafficSignPickerViewController: search field, horizontal selected chips (catalog thumbnails + “other”), 4-column results grid; applies composed tag value.
  • PresetValueTextField: + button (contactAdd) for traffic_sign* keys when currentRegion.country has a catalog.
  • TrafficSignOverlayLayer: bead-chain icon overlay on visible nodes/ways; respects directional tags and generic fallback rules; gated by country catalog and user pref.
  • Display settings: new Show Traffic Signs switch in Overlays section; UserPrefs.mapViewEnableTrafficSigns.

Scope / follow-ups

  • Catalog is Germany-only today; additional countries can be added when they land in the npm package.
  • Overlay refresh is tied to viewport changes; editor tag edits may need a pan/zoom nudge until map-data change subscription is added.
  • Compose/decompose Swift port should stay in sync when bumping @osm-traffic-signs/converter — re-run src/traffic-signs/update.sh after upgrades.

Testing notes (by @tordans)

Please verify on a DE map extent (country detection → currentRegion.country == "de"):

POI picker

  1. Select a node/way and open tags for traffic_sign (and :forward / :backward if preset exposes them).
  2. Confirm + appears in DE, hidden outside catalog countries.
  3. Tap + → picker opens with existing value decomposed into chips.
  4. Empty search → frequently used signs (not an empty grid).
  5. Search e.g. 205, 310, city_limit → grid updates.
  6. Add/remove signs; tap Done → tag value updates with correct DE: / separators.
  7. Edit a value containing free text or unknown parts → “other” chips remain after apply/reopen.

Map overlay

  1. Display → Overlays → enable Show Traffic Signs.
  2. Nodes with traffic_sign=* show icon chain at the point.
  3. Ways with sign tags show chain along the way; check traffic_sign:forward / :backward and generic fallback cases.
  4. Toggle off → overlays disappear. Outside DE → no overlay icons.

Build / release

  1. cd src/traffic-signs && ./update.sh (requires Node/npm).
  2. Full prep: cd src && ./update_all.sh includes traffic-signs step.
  3. Xcode build on device/simulator; confirm assets and TrafficSignIndex.json are in the app bundle.

Regression

  • Other POI field accessories (direction, opening hours, units) still work.
  • Data overlay / GPX / notes toggles unchanged.
Open in Web Open in Cursor 

Introduce a prep script using @osm-traffic-signs/converter that emits
TrafficSignIndex.json and TrafficSigns.xcassets for Germany. The POI editor
shows a + control on traffic_sign tags when the map country has a catalog,
opening a searchable grid picker with chip selection and compose/decompose
preserving unrecognized fragments. Display settings gain a Show Traffic Signs
toggle that draws sign chains on nodes and ways with directional tag handling.

Co-authored-by: Tobias <t@tobiasjordans.de>
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.

2 participants