The JavaScript fleet tracking library works for the following use cases:
- On-demand trips
- Scheduled tasks
This guide discusses how you can use this library for both services.
Using the JavaScript fleet tracking library, you can provide fleet operators the ability to visualize the locations of vehicles in their fleet in near real time. If the route for a vehicle is known, the map view component animates that vehicle as it moves along its predicted path.
What is fleet tracking?
Fleet tracking is a feature of Fleet Engine designed for fleet operators. It provides interfaces that model and follow fleet data in Fleet Engine, and it provides classes you use to create a rich, web-based map display of journey information for your fleet managers. For example:
- Allow on-demand trips operators the ability to track trip progress across multiple vehicles.
- Allow scheduled shipment operators the ability to see near real-time progress of fleet shipments on a web-based map.
You integrate the library into your web app and set the appropriate role profiles within Fleet Engine to support sharing journeys with the consumer. For more information about roles in Fleet Engine, see Service account roles .
Why use fleet tracking?
When you integrate fleet tracking into your fleet operations, you get a comprehensive vehicle monitoring experience, with near real-time location updates. You can see one or all fleet vehicle locations on a map, including stop or waypoint details that help you understand how your fleet is performing.
What can you do with fleet tracking?
With information from the fleet tracking library, you can create rich views of your fleet operations with the following features:
-
Personalize the fleet tracking map UI customizations to fit your needs.
-
See the current location for single, multiple, or all vehicles as they make their way along their routes, with their positions updated periodically.
-
Calculate ETAs for the trip or delivery, as well as remaining distance.
-
See vehicle progress including completed trips or task status.
Components
The following table describes the components used in fleet tracking and what they do.
On-demand trips
The vehicle location provider displays a single vehicle's location information. It has information on the vehicle location, its waypoints, and the trips assigned to the vehicle.
Following are the visibility rules for vehicles and their waypoint markers:
- Vehicle: A vehicle is visible as soon as it is
created in Fleet Engine, and is visible when the
vehicle_state
isOnline
. This means a vehicle can be visible even when there is no current trip assigned to it. - Waypoint markers: Planned vehicle waypoints are shown on the map as origin, intermediate and destination markers.
Scheduled tasks
The delivery vehicle location provider displays a single delivery vehicle's location information. It has information on the vehicle location, its stops, and the tasks completed by the delivery vehicle.
Following are the visibility rules for delivery vehicles, stops, and their tasks:
- Vehicle: A delivery vehicle is visible as soon as it is created in Fleet Engine, and is visible throughout its route regardless of its tasks.
- Stops: Planned vehicle stops are shown on the map as vehicle stop markers. Markers for completed tasks are displayed with a different style than a vehicle's planned stops.
- Tasks: The location of task outcomes are displayed
with task outcome markers. Tasks with a
SUCCEEDED
outcome are displayed with successful task markers, while all other tasks are displayed with unsuccessful task markers.
How to use fleet tracking
1 | Set up fleet tracking in JavaScript. | For more information, see Set up the JavaScript fleet tracking library . |
2 | Load the library and initialize the map. | For more information, see Load the library and initialize the map view . |
3 | Provide the vehicle location and set the map view. | To begin following a vehicle, you instantiate a location provider with the correct vehicle ID and use it to initialize the map view. For more information, see Provide the vehicle location . |
5 | Update fleet progress and handle trip errors. | For more information, see Update fleet progress and Handle errors . |
5 | When the day is complete, stop following fleet vehicles. | For more information, see Stop following a delivery vehicle . |