<iframe src="https://developers.devsite.google/frame/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd_b493de2255e744a344114e252edf6961e488ae460617eccc4af6d6273a9c86c4.frame" class="framebox inherit-locale redirect-iframe" allow="clipboard-write https://developers.devsite.google" allowfullscreen is-upgraded></iframe>

## [FleetEngineVehicleLocationProvider](https://developers.google.com/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd.md.txt#FleetEngineVehicleLocationProvider)
class


`google.maps.journeySharing.FleetEngineVehicleLocationProvider`
class

Vehicle Location Provider.

This class extends
`PollingLocationProvider`.

Access by calling `const {FleetEngineVehicleLocationProvider} = await google.maps.importLibrary("journeySharing")`.   
See [Libraries in the Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/libraries.md.txt).

| ### Constructor ||
|---|---|
| `FleetEngineVehicleLocationProvider` | `FleetEngineVehicleLocationProvider(options)` **Parameters:** - `options`: `FleetEngineVehicleLocationProviderOptions` Options to pass to the location provider. Creates a new location provider for a Fleet Engine vehicle. |

| ### Static Methods ||
|---|---|
| `TRAFFIC_AWARE_ACTIVE_POLYLINE_CUSTOMIZATION_FUNCTION` | `TRAFFIC_AWARE_ACTIVE_POLYLINE_CUSTOMIZATION_FUNCTION(params)` **Parameters:** - `params`: `VehiclePolylineCustomizationFunctionParams` The parameters provided to the polyline customization function. **Return Value:** None Polyline customization function that colors the active polyline according to its speed reading. Specify this function as the `FleetEngineVehicleLocationProviderOptions.activePolylineCustomization` to render a traffic-aware polyline for the active polyline. |
| `TRAFFIC_AWARE_REMAINING_POLYLINE_CUSTOMIZATION_FUNCTION` | `TRAFFIC_AWARE_REMAINING_POLYLINE_CUSTOMIZATION_FUNCTION(params)` **Parameters:** - `params`: `VehiclePolylineCustomizationFunctionParams` The parameters provided to the polyline customization function. **Return Value:** None Polyline customization function that colors the remaining polyline according to its speed reading. Specify this function as the `FleetEngineVehicleLocationProviderOptions.remainingPolylineCustomization` to render a traffic-aware polyline for the remaining polyline. |

| ### Properties ||
|---|---|
| `staleLocationThresholdMillis` | **Type:** `number` This Field is read-only. Threshold for stale vehicle location. If the last updated location for the vehicle is older than this threshold, the vehicle will not be displayed. |
| `vehicleId` | **Type:** `string` ID for the vehicle that this location provider observes. Set this field to track a vehicle. |

| ### Methods ||
|---|---|

| ### Events ||
|---|---|
| `error` | `function(event)` **Arguments:** - `event`: `ErrorEvent` Event that is triggered when the location provider encounters an error. |
| `update` | `function(event)` **Arguments:** - `event`: `FleetEngineVehicleLocationProviderUpdateEvent` Event that is triggered when a Fleet Engine data update request has finished. |

## [FleetEngineVehicleLocationProviderOptions](https://developers.google.com/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd.md.txt#FleetEngineVehicleLocationProviderOptions)
interface


`google.maps.journeySharing.FleetEngineVehicleLocationProviderOptions`
interface

Options for vehicle location provider.

| ### Properties ||
|---|---|
| `authTokenFetcher` | **Type:** `AuthTokenFetcher` Provides JSON Web Tokens for authenticating the client to Fleet Engine. |
| `projectId` | **Type:** `string` The consumer's project ID from Google Cloud Console. |
| `activePolylineCustomization optional` | **Type:** `(function(VehiclePolylineCustomizationFunctionParams): void)|PolylineOptions optional` Customization applied to the active polyline. An active polyline corresponds to a portion of the route the vehicle is currently traversing through. Use this field to specify custom styling (such as polyline color) and interactivity (such as click handling). - If a `PolylineOptions` object is specified, the changes specified in it are applied to the polyline after the polyline has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the polyline is created. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the polyline's coordinates change, or when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this polyline have changed. See `VehiclePolylineCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `destinationMarkerCustomization optional` | **Type:** `(function(VehicleWaypointMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to the vehicle trip destination marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `VehicleWaypointMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `intermediateDestinationMarkerCustomization optional` | **Type:** `(function(VehicleWaypointMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to the vehicle trip intermediate destination markers. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `VehicleWaypointMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `originMarkerCustomization optional` | **Type:** `(function(VehicleWaypointMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to the vehicle trip origin marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `VehicleWaypointMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `pollingIntervalMillis optional` | **Type:** `number optional` Minimum time between fetching location updates in milliseconds. If it takes longer than `pollingIntervalMillis` to fetch a location update, the next location update is not started until the current one finishes. Setting this value to 0 disables recurring location updates. A new location update is fetched if any of the parameters observed by the location provider changes. The default polling interval is 5000 milliseconds, the minimum interval. If you set the polling interval to a lower non-zero value, 5000 is used. |
| `remainingPolylineCustomization optional` | **Type:** `(function(VehiclePolylineCustomizationFunctionParams): void)|PolylineOptions optional` Customization applied to the remaining polyline. A remaining polyline corresponds to a portion of the route the vehicle has not yet started traversing through. Use this field to specify custom styling (such as polyline color) and interactivity (such as click handling). - If a `PolylineOptions` object is specified, the changes specified in it are applied to the polyline after the polyline has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the polyline is created. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the polyline's coordinates change, or when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this polyline have changed. See `VehiclePolylineCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `staleLocationThresholdMillis optional` | **Type:** `number optional` Threshold for stale vehicle location. If the last updated location for the vehicle is older this threshold, the vehicle will not be displayed. Defaults to 24 hours in milliseconds. If the threshold is less than 0, or *Infinity*, the threshold will be ignored and the vehicle location will not be considered stale. |
| `takenPolylineCustomization optional` | **Type:** `(function(VehiclePolylineCustomizationFunctionParams): void)|PolylineOptions optional` Customization applied to the taken polyline. A taken polyline corresponds to a portion of the route the vehicle has already traversed through. Use this field to specify custom styling (such as polyline color) and interactivity (such as click handling). - If a `PolylineOptions` object is specified, the changes specified in it are applied to the polyline after the polyline has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the polyline is created. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the polyline's coordinates change, or when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this polyline have changed. See `VehiclePolylineCustomizationFunctionParams` for a list of supplied parameters and their uses. |
| `vehicleId optional` | **Type:** `string optional` The vehicle ID to track immediately after the location provider is instantiated. If not specified, the location provider does not start tracking any vehicle; use `FleetEngineVehicleLocationProvider.vehicleId` to set the ID and begin tracking. |
| `vehicleMarkerCustomization optional` | **Type:** `(function(VehicleMarkerCustomizationFunctionParams): void)|MarkerOptions optional` Customization applied to the vehicle marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `VehicleMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |

## [FleetEngineVehicleLocationProviderUpdateEvent](https://developers.google.com/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd.md.txt#FleetEngineVehicleLocationProviderUpdateEvent)
interface


`google.maps.journeySharing.FleetEngineVehicleLocationProviderUpdateEvent`
interface

The event object passed to the event handler when the `FleetEngineVehicleLocationProvider.update` event is triggered.

| ### Properties ||
|---|---|
| `trips optional` | **Type:** `Array<Trip> optional` The list of trips completed by this vehicle. Unmodifiable. |
| `vehicle optional` | **Type:** `Vehicle optional` The vehicle data structure returned by the update. Unmodifiable. |

## [FleetEngineFleetLocationProvider](https://developers.google.com/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd.md.txt#FleetEngineFleetLocationProvider)
class


`google.maps.journeySharing.FleetEngineFleetLocationProvider`
class

Fleet Location Provider.

This class extends
`PollingLocationProvider`.

Access by calling `const {FleetEngineFleetLocationProvider} = await google.maps.importLibrary("journeySharing")`.   
See [Libraries in the Maps JavaScript API](https://developers.google.com/maps/documentation/javascript/libraries.md.txt).

| ### Constructor ||
|---|---|
| `FleetEngineFleetLocationProvider` | `FleetEngineFleetLocationProvider(options)` **Parameters:** - `options`: `FleetEngineFleetLocationProviderOptions` Options to pass to the location provider. Creates a new location provider for vehicles tracked by Fleet Engine. |

| ### Properties ||
|---|---|
| `locationRestriction` | **Type:** `LatLngBounds|LatLngBoundsLiteral optional` The bounds within which to track vehicles. If no bounds are set, no vehicles will be tracked. To track all vehicles regardless of location, set bounds equivalent to the entire earth. |
| `staleLocationThresholdMillis` | **Type:** `number` This Field is read-only. Threshold for stale vehicle location. If the last updated location for the vehicle is older than this threshold, the vehicle will not be displayed. |
| `vehicleFilter` | **Type:** `string optional` The filter applied when fetching the vehicles. |

| ### Methods ||
|---|---|

| ### Events ||
|---|---|
| `update` | `function(event)` **Arguments:** - `event`: `FleetEngineFleetLocationProviderUpdateEvent` Event that is triggered when a Fleet Engine data update request has finished. |

## [FleetEngineFleetLocationProviderOptions](https://developers.google.com/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd.md.txt#FleetEngineFleetLocationProviderOptions)
interface


`google.maps.journeySharing.FleetEngineFleetLocationProviderOptions`
interface

Options for fleet location provider.

| ### Properties ||
|---|---|
| `authTokenFetcher` | **Type:** `AuthTokenFetcher` Provides JSON Web Tokens for authenticating the client to Fleet Engine. |
| `projectId` | **Type:** `string` The consumer's project ID from Google Cloud Console. |
| `locationRestriction optional` | **Type:** `LatLngBounds|LatLngBoundsLiteral optional` The latitude/longitude bounds within which to track vehicles immediately after the location provider is instantiated. If not set, the location provider does not start tracking any vehicles; use `FleetEngineFleetLocationProvider.locationRestriction` to set the bounds and begin tracking. To track all vehicles regardless of location, set bounds equivalent to the entire earth. |
| `staleLocationThresholdMillis optional` | **Type:** `number optional` Threshold for stale vehicle location. If the last updated location for the vehicle is older than this threshold, the vehicle will not be displayed. Defaults to 24 hours in milliseconds. If the threshold is less than zero, or *Infinity*, the threshold will be ignored and the vehicle location will not be considered stale. |
| `vehicleFilter optional` | **Type:** `string optional` A filter query to apply when fetching vehicles. This filter is passed directly to Fleet Engine. See [ListVehiclesRequest.filter](https://goo.gle/ListVehiclesRequest-filter) for supported formats. Note that valid filters for attributes must have the "attributes" prefix. For example, `attributes.x = "y"` or `attributes."x y" = "z"`. |
| `vehicleMarkerCustomization optional` | **Type:** `function(VehicleMarkerCustomizationFunctionParams): void optional` Customization applied to a vehicle marker. Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling). - If a `MarkerOptions` object is specified, the changes specified in it are applied to the marker after the marker has been created, overwriting its default options if they exist. - If a function is specified, it is invoked once when the marker is created, before it is added to the map view. (On this invocation, the `isNew` parameter in the function parameters object is set to `true`.) Additionally, this function is invoked when the location provider receives data from Fleet Engine, regardless of whether the data corresponding to this marker have changed. See `VehicleMarkerCustomizationFunctionParams` for a list of supplied parameters and their uses. |

## [FleetEngineFleetLocationProviderUpdateEvent](https://developers.google.com/maps/documentation/javascript/reference/3.63/journey-sharing-fleet-tracking-odrd.md.txt#FleetEngineFleetLocationProviderUpdateEvent)
interface


`google.maps.journeySharing.FleetEngineFleetLocationProviderUpdateEvent`
interface

The event object passed to the event handler when the `FleetEngineFleetLocationProvider.update` event is triggered.

| ### Properties ||
|---|---|
| `vehicles optional` | **Type:** `Array<Vehicle> optional` The list of vehicles returned by the query. Unmodifiable. |