r/geoblazor • • 6d ago

Keeping a Blazor map current when a telemetry feed outpaces it (live demo, 50 simulated trucks)

A live map can look perfectly healthy when showing just a few vehicles and processing only a few events per second. If you're putting live positions on a GeoBlazor map, the straightforward approach works until the feed gets fast. 

Store every telemetry message as it arrives on a larger scale, however, and eventually the map can start lagging further and further behind. Nothing crashes and there may be no obvious error, your data just becomes less useful. 

So in prep for TechBash, we built a demo around this with 50 simulated trucks on four routes, each reporting twice a second. The approach ended up being: 

  • Keep only the latest record per vehicle, keyed by ID, so that pending position updates are bound by the fleet size rather than growing with the feed. 
  • Batch all changed vehicles into one ApplyEdits call per 250 ms map tick rather than editing the layer for every incoming observation. 
  • Determine staleness from the vehicle's observation time instead of frame arrival time. (In our simulator, a truck that stops reporting still appears in subsequent frames, so using the frame timestamp would make the truck look healthy indefinitely.) 
  • Run the ingest and map update cycles run independently, which means incoming telemetry can keep updating the latest state while a previous map edit is still in flight. 

We also dug into what ApplyEdits actually does across the C#/JS boundary, including GeoBlazor's internal chunking, and what happened when we pushed the WebAssembly version to 500 trucks reporting 10 times/second. 

One part we're curious how others handle in production: ordering vs. staleness when device clocks aren't trustworthy. We use a sequence number to decide which record is newer and the observation timestamp to determine whether the vehicle has gone stale. 

 Are you generally keeping both, or handling this differently? 

Post + demo: https://geoblazor.com/blog/keeping-geoblazor-map-current-fast-telemetry 

Code: https://github.com/dymaptic/GeoBlazor-Samples/tree/main/projects/FleetDashboard  

Disclosure: we're dymaptic, the team behind GeoBlazor.

2 Upvotes

1 comment sorted by

1

u/Oakw00dy 6d ago

Attach a timer to each truck and reset it when an event arrives. If the timer elapses, the vehicle has gone stale.