Maps API for JavaScript Developer's Guide

H.service.traffic.Service

Class Summary

This class encapsulates the HERE Traffic API in a service stub, providing methods to access its resources.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

static CONFIG_KEY : {string}

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

Method Summary

Table 2. Methods
Methods

requestIncidents (serviceParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method requests traffic incidents based on the service parameters provided.

requestFlowByTile (x, y, z, onResult, onError, opt_serviceParams) : {H.service.JsonpRequestHandle}

This method requests traffic flow data by tile coordinates

requestIncidentsByTile (x, y, z, onResult, onError, opt_serviceParams) : {H.service.JsonpRequestHandle}

This method requests traffic incident information by tile coordinates

Class Description

This class encapsulates the HERE Traffic API in a service stub, providing methods to access its resources.

It's not allowed to call the constructor directly (an IllegalOperationError is thrown). Instead an instance of this Service can be retrieved by calling the factory method H.service.Platform#getTrafficService on a platform instance.

Example

// Assumption: the platform is instantiated
traffic = platform.getTrafficService();

traffic.requestIncidentsByTile(
  8192, 5450, 14, // x, y, z - London
  console.log,
  console.error
);

Constructor Details

H.service.traffic.Service(opt_options)

Parameters:
 
opt_options:
{H.service.traffic.Service.Options=} [optional]
 
Configuration options for traffic service

Property Details

static CONFIG_KEY: {string}

The property name to use when specifying options for this service within the H.service.Platform.Options#servicesConfig.

Method Details

requestIncidents (serviceParams, onResult, onError) : {H.service.JsonpRequestHandle}

This method requests traffic incidents based on the service parameters provided.

Parameters:
 
serviceParams:
{H.service.ServiceParameters}
 
onResult:
{function(H.service.ServiceResult)}
 
onError:
{function(Error)}
 

requestFlowByTile (x, y, z, onResult, onError, opt_serviceParams) : {H.service.JsonpRequestHandle}

This method requests traffic flow data by tile coordinates

Parameters:
 
x:
{number}
 
tile column number
y:
{number}
 
tile row number
z:
{number}
 
zoom level
onResult:
{function(H.service.ServiceResult)}
 
onError:
{function(Error)}
 
opt_serviceParams:
{H.service.ServiceParameters=} [optional]
 
optional service parameters to be added to the request

requestIncidentsByTile (x, y, z, onResult, onError, opt_serviceParams) : {H.service.JsonpRequestHandle}

This method requests traffic incident information by tile coordinates

Parameters:
 
x:
{number}
 
tile column number
y:
{number}
 
tile row number
z:
{number}
 
zoom level
onResult:
{function(H.service.ServiceResult)}
 
callback to handle a service response
onError:
{function(Error)}
 
callback to handle a communication error
opt_serviceParams:
{H.service.ServiceParameters=} [optional]
 
optional service parameters to be added to the request