Fly.ioTutorial
Maps, Apps, and Tracks
Summary
Maps, Apps, and Tracks describes how to build an online map that tracks a marathon runner from a mobile device and deploys it with Fly. The route is drawn and exported as GPX, imported into Google My Maps, enriched with mile markers, and exported as KML for display through Leaflet.js and the leaflet-kml plugin. An Express server accepts OwnTracks HTTP POSTs at /log/, filters location messages by a hard-coded topic, stores latitude and longitude in memory, and exposes them through /where/. Browser code places or moves a marker by polling that endpoint every 30 seconds, while static files are served from the mappages directory. Local testing uses a shell script with mock OwnTracks JSON, and Fly deployment uses flyctl, fly init, and fly deploy; the post notes authentication, Redis persistence, and multiple runners as possible additions.
Context
The project needed an online map that could display a marathon route and collect and show a runner’s location from a mobile device, without requiring a custom mobile app.
Approach / What changed
The route is prepared as KML and rendered with Leaflet.js. OwnTracks sends location data to a Node and Express server, which stores one runner’s coordinates in memory and serves them through HTTP endpoints. A browser polls the location endpoint every 30 seconds, and the application is deployed with flyctl.
Takeaways
The route workflow uses GPX from OnTheGoMap.com, Google My Maps for mile markers, and KML as the map asset consumed by leaflet-kml.
The /log/ endpoint accepts OwnTracks JSON, retaining coordinates only when _type is "location" and the topic matches the hard-coded Markathon topic.
The implementation keeps coordinates in memory for simplicity; the post identifies Redis backing, authentication, and multiple-runner support as future additions.
Source and freshness
- Source
- fly.io
- Published
- Added to Yomu
- Last updated
Summaries are generated from the original by a language model. Check the original before relying on it.
Keep reading
Related reading
The Good Stuff
Paid picks we use ourselves. Links carry a referral code — a subscription through one earns us a commission at no extra cost to you.
The best engineering reads, once a week
One useful email. Unsubscribe anytime.