Coreflux Templates

Helsinki Tram Live Feed Geofence

Stream tram positions from HSL MQTT into Coreflux and fire downtown enter/leave geofence events.

Dataflow

How it flows

Actions, models, routes and the topics that link them. Click a node to trace its flow.

How it works

This Coreflux LoT notebook bridges HSL’s public MQTT feed for Helsinki trams into local topics, then validates, digests, and geofences each vehicle position. It turns a live transport stream into per-tram state plus one-off downtown enter/leave events.

Key features

  • MQTT bridge: Subscribes to mqtt.hsl.fi and lands tram messages under demo/trams/feed/raw/#.
  • Payload gate: Checks VP.lat before parsing and routes bad messages to feed/fetch_error.
  • Per-vehicle digest: Writes line, latitude, longitude, speed, speed_kmh, and heading under demo/trams/vehicle/<veh>/.
  • Collapsed position model: Publishes TramPosition as a single position document for map consumers.
  • Downtown geofence: Detects rectangular enter/leave transitions for each tram.

What this template does

  • Consumes the HFP v2 tram subset from HSL over MQTT.
  • Normalizes valid vehicle positions into stable vehicle topics.
  • Keeps geofence memory per vehicle with KEEP state.
  • Emits edge-triggered events only when a tram crosses the downtown box.

Prerequisites

The notebook

What’s inside

Browse the markdown and code cells before you download.

LoT Notebook:demo_helsinki_trams.lotnb
Related use cases

Similar templates

Templates chosen for overlap in routes, tags, and category.

View all in Smart Cities

Get this template

1 file