Live Train Map

getLiveTrainMap()

Description

Scale plan exclusive. Get current running-train positions for map clients, with location coordinates, snapshot time, and freshness flag.

Parameters

No parameters.

Code Example

javascript
import { configure, getLiveTrainMap } from "railkit";

configure(process.env.RAILKIT_API_KEY);

const result = await getLiveTrainMap();

if (result.success) {
  console.log(result.data.lastSweepAt, result.data.stale);
  console.log(result.data.mappedCount, result.data.trains);
}

Response Example

JSON response
200JSON