Skip to content

Signal

Map

Map

The transit map's design of record: sources of truth, zoom bands, layer order and rules.

The lines lead; the basemap recedes. @chitransit/signal/map owns shared MapLibre rendering for web and React Native. The API owns topology, corridors, signed lane order, station associations and valid turns; the app owns live data and interaction.

One renderer

tokens/map.json holds sizes, named states and paint-only style profiles. map/renderer.mjs builds one cached z17 geographic centerline and its continuously scaled style layers. Generated JSON styles and the live playground use that same module. No MapLibre runtime is bundled in Signal.

import { createStyle, trainRouteFeatures, stationFeatures, nativeLayers } from '@chitransit/signal/map';
sources['train-offset'].data = trainRouteFeatures(apiTopology); // once per topology load
const { marks, stations } = stationFeatures(snappedGroups);
const style = createStyle({ theme: 'dark', profile: 'diagram', sources, glyphs });
// MapLibre RN v11: <Layer {...layer} /> inside its GeoJSONSource
const stationLayers = nativeLayers(style.layers, 'station-marks');

Rendering rules

  • Corridor centrelines, corner radius and API-authorised turn connectors are shaped once at the reference zoom (z17); MapLibre offsets each lane in screen space while zooming and never swaps source geometry (Line rendering).
  • Station marks are round-capped line features, never zoom-rebuilt sprites. Bridges form a straight N–S or E–W chain, whichever is closest to perpendicular to the lanes. They intersect each served lane and never bridge an absent lane. The map’s rotation rotates the chain with it.
  • Loop direction patterns only on authoritative one-way Loop lanes; half the previous density. Bidirectional and unknown directions have no arrows.
  • Connected station circles and bridges remain connected at every visible zoom. Marker and font sizes may scale independently; routes, gaps, offsets, corners and junction geometry stay fixed in map space.
  • geographic, diagram and boldDiagram profiles vary paint weights, labels and basemap visibility over that exact backbone. Light/dark theme is independent.
  • Bus squares begin fading in at z14.8, grow to 32 px at z18 with the Signal bus glyph, and reveal the selected stop name and route capsules at close zoom.
  • Figtree Bold labels: next stop first, then selected/on-path, then passed and unrelated stations. Collision placement stays on; lower priorities yield.
  • Train vehicles are route-colour teardrops, glyph upright, with a separate 44 pt hit target. A selected vehicle shows an ETA chip; other vehicles hide.
  • Camera and placeholder share the visible viewport, accounting for sheet/sidebar padding. Nearby placeholder is absent below z12 and outside Nearby.

Zoom ramps

Band or elementZoom (512 px tiles)
Far bandFrom z9: thin lanes, simple station dots, no chevrons
Mid bandFrom z13: brand-logo station marks and labels, walking transfers (if on), upcoming-stop times; Loop chevrons from z15
Near bandFrom z16: wide lanes, bus stops (from z14.8), bus-stop direction chevrons (from z17)
Train lanesz9
Station circlesFrom z10.5 (non-Loop)
Connected station marksFrom z12.01 (bridges, links, Loop circles); same geometry at every zoom
VehiclesFar circle from z9 (no tip to z12); full marker with glyph from z13
Map-centre placeholderFrom z12, a constant 21 pt
Ramps endz18; values hold beyond the last stop

Named route-view states · Size ramps · Try all states