Maps API for JavaScript Developer's Guide

H.service.TrafficIncidentsProvider

Class Summary

Extends: H.map.provider.MarkerTileProvider

This class represents traffic incidents provider which requests traffic incidents data from platform traffic incidents service and converts it to map objects.

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

min : {number}

Minimum zoom level at which provider can serve data, set at construction time

max : {number}

Maximum zoom level at which provider can server data, set at construction time

uid : {string}

Provider instance unique identifier, generated at construction time

tileSize : {number}

The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is {@code 256

Method Summary

Table 2. Methods
Methods

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object

removeEventListener (type, handler, opt_capture, opt_scope)

This method will removed previously added listener from the event target

dispatchEvent (evt)

This method will dispatch event on the event target object

dispose ()

Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds callback which is triggered when the object is being disposed

getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}

This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.

requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}

Request data on a tile basis

cancelTile (x, y, z)

Cancels tile from being requested using x, y, z coordinates (column, row, zoom)

cancelTileByKey (tileKey)

Cancels tile from being requested using a tile-key

getTileKey (x, y, z) : {string}

This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by underscores e.g.: "4711_7_42_23"

getCache () : {H.util.Cache}

This method returns cache which should be used to store tiles

requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}

This method request tile from remote service

reload (hard)

This method instructs the provider to reload data from it's source.

invalidateObject (marker, flags)

To signal to this provider that a map object has been changed. The method marks tile, that contains that objectm as invalid and triggers dispatchUpdate()

providesDomMarkers () : {boolean}

Checks whether this provider is currently providing H.map.DomMarker map objects.

Class Description

This class represents traffic incidents provider which requests traffic incidents data from platform traffic incidents service and converts it to map objects.

Constructor Details

H.service.TrafficIncidentsProvider(service, opt_refreshTime, opt_additionalParameters)

Parameters:
 
service:
{H.service.TrafficIncidentsService}
 
traffic incidents service that serves incidents data
opt_refreshTime:
{number=} [optional]
 
argument indicates timeframe when provider tiles should be updated (in ms) defaults to 3 minutes
opt_additionalParameters:
{H.service.ServiceParameters=} [optional]
 
an additional set of URL parameters

Property Details

min: {number}

Minimum zoom level at which provider can serve data, set at construction time

max: {number}

Maximum zoom level at which provider can server data, set at construction time

uid: {string}

Provider instance unique identifier, generated at construction time

tileSize: {number}

The size of a tile as edge length in pixels. It must be 2^n where n is in range [0 ... 30], default is {@code 256

Method Details

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object

Parameters:
 
type:
{string}
 
name of event
handler:
{!Function}
 
event handler function
opt_capture:
{boolean=} [optional]
 
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method will removed previously added listener from the event target

Parameters:
 
type:
{string}
 
name of event
handler:
{!Function}
 
previously added event handler
opt_capture:
{boolean=} [optional]
 
if set to true will listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
scope for the handler function

dispatchEvent (evt)

This method will dispatch event on the event target object

Parameters:
 
evt:
{(H.util.Event | string)}
 
event object or event name

dispose ()

Removes listeners from this object. Classes that extend EventTarget may need to override this method in order to remove references to DOM Elements and additional listeners.

addOnDisposeCallback (callback, opt_scope)

This method adds callback which is triggered when the object is being disposed

Parameters:
 
callback:
{!Function}
 
opt_scope:
{Object=} [optional]
 

getCopyrights (bounds, level) : {?Array<H.map.ICopyright>}

This method returns the copyrights of the provided content for a certain geographical area at a specified zoom level.

Note: This function must be overridden by any class inheriting the Provider class. The default implementation returns null.

Parameters:
 
bounds:
{H.geo.Rect}
 
The bounding area for which to retrieve the copyright information
level:
{number}
 
The zoom level for which to retrieve the copyright information
Returns:
 
{?Array<H.map.ICopyright>}
a list of copyright information objects for the provided area and zoom level

requestTile (x, y, z, cacheOnly) : {(H.map.provider.Tile | undefined)}

Request data on a tile basis

Parameters:
 
x:
{number}
 
The row number of the tile
y:
{number}
 
The column number of the tile
z:
{number}
 
The zoom level for which the tile is requested
cacheOnly:
{boolean}
 
Indicates whether only cached tiles are to be considered
Returns:
 
{(H.map.provider.Tile | undefined)}
tile object

cancelTile (x, y, z)

Cancels tile from being requested using x, y, z coordinates (column, row, zoom)

Parameters:
 
x:
{number}
 
x tile coordinate (row)
y:
{number}
 
y tile coordinate (column)
z:
{number}
 
tile coordinate (zoom)

cancelTileByKey (tileKey)

Cancels tile from being requested using a tile-key

Parameters:
 
tileKey:
{string}
 
The key of the tile

getTileKey (x, y, z) : {string}

This method creates a tile key consisting of the provider's uid, and the tile's x, y and z coordinates, seperated by underscores e.g.: "4711_7_42_23"

Parameters:
 
x:
{number}
 
The x tile coordinate (row)
y:
{number}
 
The y tile coordinate (column)
z:
{number}
 
The z tile coordinate (zoom level)
Returns:
 
{string}
string

getCache () : {H.util.Cache}

This method returns cache which should be used to store tiles

Returns:
 
{H.util.Cache}
cache

requestInternal (x, y, z, onResponse, onError) : {H.util.ICancelable}

This method request tile from remote service

Parameters:
 
x:
{number}
 
The row number of the tile
y:
{number}
 
The column number of the tile
z:
{number}
 
The zoom level for which the tile is requested
onResponse:
{function((Array<H.map.Object> | HTMLImageElement | HTMLCanvasElement | null))}
 
function which is called after response arrives
onError:
{function(string)}
 
function which is called in case of communication error
Returns:
 
{H.util.ICancelable}

reload (hard)

This method instructs the provider to reload data from it's source.

Two reload modes are possible:

  • hard: A hard immediately removes the cached tiles from the tile cache and forces the provider to re-fetch the tiles. Currently cached tiles will not be used for rendering.
  • soft: A soft invalidation only marks tiles as invalid and requests the tiles to be re-fetched at the earliest convenience. The provider does not invalidate the cache immediately in this case. This means that cached tiles can still be rendered while the updated tiles are fetched.
Parameters:
 
hard:
{boolean}
 
a boolean flag indicating whether to invalidate in hard mode (true) or in soft mode (false);

invalidateObject (marker, flags)

To signal to this provider that a map object has been changed. The method marks tile, that contains that objectm as invalid and triggers dispatchUpdate()

Parameters:
 
marker:
{!H.map.AbstractMarker}
 
The map object to be invalidated
flags:
{H.math.BitMask}
 
The flags indicating the types of occurred changes

providesDomMarkers () : {boolean}

Checks whether this provider is currently providing H.map.DomMarker map objects.

Returns:
 
{boolean}

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.