Fleet Tracking - On Demand Rides & Delivery (beta)

FleetEngineVehicleLocationProvider class

google.maps.journeySharing.FleetEngineVehicleLocationProvider class

Vehicle Location Provider.

This class extends PollingLocationProvider.

Access by callingconst {FleetEngineVehicleLocationProvider} = await google.maps.importLibrary( "journeySharing" ).SeeLibraries in the Maps JavaScript API.

FleetEngineVehicleLocationProvider
FleetEngineVehicleLocationProvider(options)
Parameters:
Creates a new location provider for a Fleet Engine vehicle.
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.
Inherited: isPolling, pollingIntervalMillis
Inherited: addListener
error
function(event)
Arguments:
Event that is triggered when the location provider encounters an error.
update
function(event)
Event that is triggered when a Fleet Engine data update request has finished.
Inherited: ispollingchange

FleetEngineVehicleLocationProviderOptions interface

google.maps.journeySharing.FleetEngineVehicleLocationProviderOptions interface

Options for vehicle location provider.

authTokenFetcher
Provides JSON Web Tokens for authenticating the client to Fleet Engine.
projectId
Type:string
The consumer's project ID from Google Cloud Console.
destinationMarkerCustomizationoptional
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 aMarkerOptionsobject 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, theisNewparameter in the function parameters object is set totrue.) 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.

    SeeVehicleWaypointMarkerCustomizationFunctionParamsfor a list of supplied parameters and their uses.
intermediateDestinationMarkerCustomizationoptional
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 aMarkerOptionsobject 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, theisNewparameter in the function parameters object is set totrue.) 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.

    SeeVehicleWaypointMarkerCustomizationFunctionParamsfor a list of supplied parameters and their uses.
originMarkerCustomizationoptional
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 aMarkerOptionsobject 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, theisNewparameter in the function parameters object is set totrue.) 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.

    SeeVehicleWaypointMarkerCustomizationFunctionParamsfor a list of supplied parameters and their uses.
pollingIntervalMillisoptional
Type:numberoptional
Minimum time between fetching location updates in milliseconds. If it takes longer thanpollingIntervalMillisto 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.
staleLocationThresholdMillisoptional
Type:numberoptional
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, orInfinity,the threshold will be ignored and the vehicle location will not be considered stale.
vehicleIdoptional
Type:stringoptional
The vehicle ID to track immediately after the location provider is instantiated. If not specified, the location provider does not start tracking any vehicle; useFleetEngineVehicleLocationProvider.vehicleIdto set the ID and begin tracking.
vehicleMarkerCustomizationoptional
Customization applied to the vehicle marker.

Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling).
  • If aMarkerOptionsobject 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, theisNewparameter in the function parameters object is set totrue.) 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.

    SeeVehicleMarkerCustomizationFunctionParamsfor a list of supplied parameters and their uses.

FleetEngineVehicleLocationProviderUpdateEvent interface

google.maps.journeySharing.FleetEngineVehicleLocationProviderUpdateEvent interface

The event object passed to the event handler when theFleetEngineVehicleLocationProvider.updateevent is triggered.

tripsoptional
Type:Array<Trip>optional
The list of trips completed by this vehicle. Unmodifiable.
vehicleoptional
Type:Vehicleoptional
The vehicle data structure returned by the update. Unmodifiable.

FleetEngineFleetLocationProvider class

google.maps.journeySharing.FleetEngineFleetLocationProvider class

Fleet Location Provider.

This class extends PollingLocationProvider.

Access by callingconst {FleetEngineFleetLocationProvider} = await google.maps.importLibrary( "journeySharing" ).SeeLibraries in the Maps JavaScript API.

FleetEngineFleetLocationProvider
FleetEngineFleetLocationProvider(options)
Parameters:
Creates a new location provider for vehicles tracked by Fleet Engine.
locationRestriction
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:stringoptional
The filter applied when fetching the vehicles.
Inherited: isPolling, pollingIntervalMillis
Inherited: addListener
update
function(event)
Event that is triggered when a Fleet Engine data update request has finished.
Inherited: ispollingchange

FleetEngineFleetLocationProviderOptions interface

google.maps.journeySharing.FleetEngineFleetLocationProviderOptions interface

Options for fleet location provider.

authTokenFetcher
Provides JSON Web Tokens for authenticating the client to Fleet Engine.
projectId
Type:string
The consumer's project ID from Google Cloud Console.
locationRestrictionoptional
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; useFleetEngineFleetLocationProvider.locationRestrictionto set the bounds and begin tracking. To track all vehicles regardless of location, set bounds equivalent to the entire earth.
staleLocationThresholdMillisoptional
Type:numberoptional
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, orInfinity,the threshold will be ignored and the vehicle location will not be considered stale.
vehicleFilteroptional
Type:stringoptional
A filter query to apply when fetching vehicles. This filter is passed directly to Fleet Engine.

SeeListVehiclesRequest.filterfor supported formats.

Note that valid filters for attributes must have the "attributes" prefix. For example,attributes.x = "y"orattributes. "x y" = "z".
vehicleMarkerCustomizationoptional
Type:function(VehicleMarkerCustomizationFunctionParams): voidoptional
Customization applied to a vehicle marker.

Use this field to specify custom styling (such as marker icon) and interactivity (such as click handling).
  • If aMarkerOptionsobject 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, theisNewparameter in the function parameters object is set totrue.) 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.

    SeeVehicleMarkerCustomizationFunctionParamsfor a list of supplied parameters and their uses.

FleetEngineFleetLocationProviderUpdateEvent interface

google.maps.journeySharing.FleetEngineFleetLocationProviderUpdateEvent interface

The event object passed to the event handler when theFleetEngineFleetLocationProvider.updateevent is triggered.

vehiclesoptional
Type:Array<Vehicle>optional
The list of vehicles returned by the query. Unmodifiable.