Fleet tracking overview

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.

Fleet tracking map view example

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 consumer use of journey sharing. 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

Component Description
Journey sharing map view The journey sharing map view shows the location of vehicles and their trips. If Fleet Engine knows the route for a vehicle, the map view component animates that vehicle as it moves along its predicted path.
Vehicle location provider

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 is Online. 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.
Customization options The vehicle location provider options allow you to provide polyline and marker customizations. You can color and style polylines to display a variety of real-world scenarios for the vehicle, such as taken routes and traffic. You can customize markers for different purposes. You can also add click handling to polylines and markers.
Vehicle event listener The event listener allows the operator to get information about trips completed by a vehicle.
Vehicle fleet location provider The fleet location provider displays multiple delivery vehicles' location information. When tracking a fleet, you set geographical bounds and you also have the option to filter by vehicle IDs.

Scheduled tasks

Component Description
Journey sharing map view The journey sharing map view shows the location of delivery vehicles and tasks. If Fleet Engine knows the route for a vehicle, the map view component animates that vehicle as it moves along its predicted path.
Delivery vehicle location provider

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.
Customization options The delivery vehicle location provider options allow you to provide polyline and marker customizations. You can color and style polylines to display a variety of real-world scenarios for the vehicle, such as the vehicle's active route. You can customize markers for different purposes, such as for a delivery vehicle. You can also add click handling to polylines and markers.
Delivery task filter The task filter allows the operator to filter the view for tasks completed before or after a specified time, as well as filtering by open or closed tasks.
Delivery vehicle event listener The event listener allows the operator to get information about journey segments completed by a delivery vehicle, as well as a list of tasks served by the vehicle.
Delivery fleet location provider The delivery fleet location provider displays multiple delivery vehicles' location information. You can filter to display a specific delivery vehicle and its location, or you can display vehicle locations for the entire fleet.

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.

What's next