A Node-RED function node that pulls live Amtrak (and VIA Rail) train positions from TransitDocs and pushes them to ATAK as Cursor on Target (CoT) events. Trains are displayed on the ATAK map with color-coded icons reflecting their on-time status.
- Live train positions with heading and speed
- Color-coded icon overlays based on delay status
- Next stop with early/late status in the CoT remarks
- Active Amtrak alert messages displayed inline
- Service disruption flagging
- Automatic 30-second refresh via Node-RED inject node
| Color | Meaning |
|---|---|
| 🟢 Green | On time (< 5 min late) |
| 🟡 Yellow | Late (5–29 min late) |
| 🔴 Red | Very late (30–59 min late) |
| ⚫ Black | Extremely late (60+ min late) |
| ⚪ Gray | Service disruption reported |
- Node-RED
- ATAK or WinTAK with network connectivity to your Node-RED instance
- Generic Icons iconset installed in ATAK
- Iconset UID:
ad78aafb-83a6-4c07-b2b9-a897a8b6a38f - Icon:
Shapes/rail.png
- Iconset UID:
[Inject (30s)] → [HTTP Request] → [Function] → [TCP Out]
Inject Node
- Repeat:
interval - Every:
30 seconds
HTTP Request Node
- Method:
GET - URL:
https://asm-backend.transitdocs.com/map - Return:
a parsed JSON object
Function Node
- Paste the contents of `AmtrakMap2COT.json' into a function node
TCP Out Node
- Address: Your TAK server or ATAK device IP
- Port:
8089 - Upload your certs to your server
- Make sure Verify Server is unchecked
Each train is emitted as a CoT XML event with type a-f-G-E-V-T (friendly ground train):
<event version="2.0" uid="TRAIN-2026-02-22_AMTK_99" type="a-f-G-E-V-T" ...>
<point lat="40.742966" lon="-73.946077" hae="9999999.0" ce="9999999.0" le="9999999.0"/>
<detail>
<contact callsign="99 - Northeast Regional"/>
<track course="225" speed="20.81"/>
<remarks>BOS → NPN | Speed: 46.53 mph | Next Stop: NWK (14 min early) | 🚨 Delay Notification: ...</remarks>
<usericon iconsetpath="ad78aafb-83a6-4c07-b2b9-a897a8b6a38f/Shapes/rail.png"/>
<color argb="-256"/>
</detail>
</event>Delay status is determined in the following priority order:
- Alert text — parses
"approximately X minutes late"directly from Amtrak's alert messages - Last ACTUAL departure variance — reads the most recently departed stop's actual vs. scheduled time
- Next ESTIMATED stop variance — fallback for trains early in their journey with no actuals yet
Thresholds are defined at the top of function.js and can be adjusted:
const LATE_MIN = 5; // Yellow
const VERY_LATE_MIN = 30; // Red
const EXTREMELY_LATE_MIN = 60; // BlackTrain positions and schedule data are sourced from the TransitDocs public API:
https://asm-backend.transitdocs.com/map
This endpoint returns live position, speed, heading, stop-level variance, and delay alerts for all active Amtrak and VIA Rail trains.
- Trains without a
locationfield are filtered out and not sent as CoT events - The CoT stale time is set to 120 seconds — if the inject interval is changed, update
staleCot()accordingly - VIA Rail trains are included in the feed and will appear on the map alongside Amtrak trains