RouteInput
The type definition for the route data that can be provided to the route
property of PlayerOptions
. It accepts one of the following formats:
Type Definition
typescript
import { RoutePoint } from './types';
type RouteInput =
| RoutePoint[]
| { [trackId: string]: RoutePoint[] }
| string;
Formats
Single Route:
RoutePoint[]
An array ofRoutePoint
objects, representing a single moving entity.typescriptconst singleRoute: RouteInput = [ { lat: 35.68, lng: 139.76, t: 1678886400000 }, { lat: 35.68, lng: 139.77, t: 1678886460000 }, ];
Multiple Routes (Multi-track):
{ [trackId: string]: RoutePoint[] }
An object where keys are track IDs (any string) and values areRoutePoint
arrays for that track. Allows representing multiple moving entities simultaneously.typescriptconst multiTrackRoute: RouteInput = { car1: [ { lat: 35.68, lng: 139.76, t: 1678886400000 }, { lat: 35.68, lng: 139.77, t: 1678886460000 }, ], bikeA: [ { lat: 35.685, lng: 139.765, t: 1678886410000 }, { lat: 35.685, lng: 139.775, t: 1678886450000 }, ], };
URL:
string
A URL from which route data (e.g., GeoJSON LineString with times) can be fetched. (Currently not implemented)