Maps API for JavaScript Developer's Guide

H.map.provider.RemoteTileProvider

Class Summary

Extends: H.map.provider.TileProvider

RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement the method requestInternal (to request a remote tile) and getCache (to provide configured cache object were tiled data is being cached).

[ For full details, see the Class Details ]

Property Summary

Table 1. Properties
Properties

tileSize : {number}

This property holds the size of a tile representing edge length in pixels. Its value must be 2^n where n is in range [0 ... 30], default is 256.

uri : {string}

This property holds the provider's unique resource identifier. If it is not provided at construction time, it defaults to provider's uid.

min : {number}

This property holds a value indicating the minimum zoom level at which the given provider can serve data. The value is set at construction time.

max : {number}

This property holds a value indicating the maximum zoom level at which the given provider can serve data. The value is set at construction time.

uid : {string}

This property holds the unique identifier for the provider instance. The value is generated at construction time.

Method Summary

Table 2. Methods
Methods

getCache () : {H.util.ICache}

This method retrieves a tile cache of this provider.

reload (hard)

This method instructs the provider to reload data from its source.

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

To request a tile from a remote service. This method must be implemented by deriving classes.

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

This method requests data for a tile.

cancelTile (x, y, z)

This method cancels a tile request, using the caller-supplied tile coordinates.

cancelTileByKey (tileKey)

This method cancels a tile request, using a tile key.

protected createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}

The internal method to create a tile. It must be overridden by sub-classes.

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

This method creates a tile key consisting of the provider's URI, and the x, y and z coordinates of the tile, separated by underscores, for example "4711_7_42_23".

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

This method retrieves the copyrights for the provided content for a certain geographical area and zoom level.

providesRasters () : {boolean}

This method checks whether this provider will provide bitmap images as tiles. A concrete implementation of Provider must override it if it will provide raster tiles.

providesSpatials () : {boolean}

This method checks whether this provider will provide spatial map objects. A concrete implementation of Provider must override it if it will provide Spatials.

providesOverlays () : {boolean}

This method checks whether this provider will provide overlay map objects. A concrete implementation of Provider must override it if it will provide overlays.

providesMarkers () : {boolean}

This method checks whether this provider will provide Marker map objects. A concrete implementation of Provider must override it if it will provide Markers.

providesDomMarkers () : {boolean}

This method checks whether this provider will provide DomMarker map objects. A concrete implementation of Provider must override it if it will provide DomMarkers.

setStyleInternal (style, opt_suppressChangeEvent)

This method sets the style to be used to render the provider data.

getStyleInternal () : {H.map.Style}

This methods returns the style used to render the provider data.

addEventListener (type, handler, opt_capture, opt_scope)

This method adds a listener for a specific event.

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the EventTarget instance.

dispatchEvent (evt)

This method dispatches an event on the EventTarget object.

dispose ()

This method removes listeners from the given 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 a callback which is triggered when the EventTarget object is being disposed.

Events Summary

Table 3. Events
Events

update : {H.util.Event}

Event fired when this provider's data updates.

Class Description

RemoteTileProvider is an abstract class which should be used by classes implementing data provision on a tile basis. Every child class needs to implement the method requestInternal (to request a remote tile) and getCache (to provide configured cache object were tiled data is being cached).

Constructor Details

H.map.provider.RemoteTileProvider(options)

Parameters:
 
options:
{H.map.provider.TileProvider.Options}
 
The options to instantiate a TileProvider instance

Property Details

tileSize: {number}

This property holds the size of a tile representing edge length in pixels. Its value must be 2^n where n is in range [0 ... 30], default is 256.

uri: {string}

This property holds the provider's unique resource identifier. If it is not provided at construction time, it defaults to provider's uid.

min: {number}

This property holds a value indicating the minimum zoom level at which the given provider can serve data. The value is set at construction time.

max: {number}

This property holds a value indicating the maximum zoom level at which the given provider can serve data. The value is set at construction time.

uid: {string}

This property holds the unique identifier for the provider instance. The value is generated at construction time.

Method Details

getCache () : {H.util.ICache}

This method retrieves a tile cache of this provider.

Returns:
 
{H.util.ICache}
cache An object representing a tile cache

reload (hard)

This method instructs the provider to reload data from its source.

Two reload modes are possible:

  • hard: This mode immediately removes tiles from the tile cache and forces the provider to re-fetch them. Currently cached tiles are not used for rendering.
  • soft: This mode only marks tiles as invalid and requests the tiles to be re-fetched as soon as possible. The provider does not invalidate the cache immediately. 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);

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

To request a tile from a remote service. This method must be implemented by deriving classes.

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 | ArrayBuffer | null), *=)}
 
A function which is called when a response arrives
onError:
{function(string=)}
 
A function which is called on a communication error
opt_priority:
{H.util.Job.Priority=} [optional]
 
An optional request priority level
Returns:
 
{H.util.ICancelable}
An object implementing ICancelable

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

This method requests data for a tile.

Parameters:
 
x:
{number}
 
The tile coordinate on x-axis (column index)
y:
{number}
 
The tile coordinate on y-axis (row index)
z:
{number}
 
The zoom level for which the tile is requested
cacheOnly:
{boolean}
 
A value indicating whether only cached tiles are to be considered (true) or not (false)
Returns:
 
{(H.map.provider.Tile | undefined)}
The tile object if it can be obtained, otherwise undefined

cancelTile (x, y, z)

This method cancels a tile request, using the caller-supplied tile coordinates.

Parameters:
 
x:
{number}
 
The tile coordinate on x-axis (column index)
y:
{number}
 
The tile coordinate on y-axis (row index)
z:
{number}
 
The tile zoom level

cancelTileByKey (tileKey)

This method cancels a tile request, using a tile key.

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

protected createTileInternal (x, y, z, data, opt_options) : {H.map.provider.Tile}

The internal method to create a tile. It must be overridden by sub-classes.

Parameters:
 
x:
{number}
 
The tile coordinate on x-axis (column index)
y:
{number}
 
The tile coordinate on y-axis (row index)
z:
{number}
 
The tile zoom level
data:
{(HTMLImageElement | HTMLCanvasElement | Object)}
 
A data that represents the tile
opt_options:
{Object<string, *>=} [optional]
 
The options to configure the tile-specific rendering
Returns:
 
{H.map.provider.Tile}
The created tile

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

This method creates a tile key consisting of the provider's URI, and the x, y and z coordinates of the tile, separated by underscores, for example "4711_7_42_23".

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

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

This method retrieves the copyrights for the provided content for a certain geographical area and zoom level.

Note: This function may be overridden by H.map.provider.Provider.Options.getCopyrights property. The default implementation returns null.

Parameters:
 
boundingBox:
{H.geo.Rect}
 
The rectangular 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

providesRasters () : {boolean}

This method checks whether this provider will provide bitmap images as tiles. A concrete implementation of Provider must override it if it will provide raster tiles.

Returns:
 
{boolean}
A value indicating if the given provider provides raster tiles (true) or not (false)

providesSpatials () : {boolean}

This method checks whether this provider will provide spatial map objects. A concrete implementation of Provider must override it if it will provide Spatials.

Returns:
 
{boolean}
A value indicating whether the provider provides map objects (true) or not (false)

providesOverlays () : {boolean}

This method checks whether this provider will provide overlay map objects. A concrete implementation of Provider must override it if it will provide overlays.

Returns:
 
{boolean}
true if the provider provides overlays, otherwise false

providesMarkers () : {boolean}

This method checks whether this provider will provide Marker map objects. A concrete implementation of Provider must override it if it will provide Markers.

Returns:
 
{boolean}
A value indicating if the given provider provides Markers (true) or not (false)

providesDomMarkers () : {boolean}

This method checks whether this provider will provide DomMarker map objects. A concrete implementation of Provider must override it if it will provide DomMarkers.

Returns:
 
{boolean}
A value indicating if the given provider provides DomMarkers (true) or not (false)

setStyleInternal (style, opt_suppressChangeEvent)

This method sets the style to be used to render the provider data.

Parameters:
 
style:
{H.map.Style}
 
The style to use for rendering the provider data.
opt_suppressChangeEvent:
{boolean=} [optional]
 
Flag to suppress firing of config change event.

getStyleInternal () : {H.map.Style}

This methods returns the style used to render the provider data.

Returns:
 
{H.map.Style}

addEventListener (type, handler, opt_capture, opt_scope)

This method adds a listener for a specific event.

Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it.

Parameters:
 
type:
{string}
 
The name of the event
handler:
{!Function}
 
An event handler function
opt_capture:
{boolean=} [optional]
 
true indicates that the method should listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
An object defining the scope for the handler function

removeEventListener (type, handler, opt_capture, opt_scope)

This method removes a previously added listener from the EventTarget instance.

Parameters:
 
type:
{string}
 
The name of the event
handler:
{!Function}
 
A previously added event handler
opt_capture:
{boolean=} [optional]
 
true indicates that the method should listen in the capture phase (bubble otherwise)
opt_scope:
{Object=} [optional]
 
An oject defining the scope for the handler function

dispatchEvent (evt)

This method dispatches an event on the EventTarget object.

Parameters:
 
evt:
{(H.util.Event | string)}
 
An object representing the event or a string with the event name

dispose ()

This method removes listeners from the given 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 a callback which is triggered when the EventTarget object is being disposed.

Parameters:
 
callback:
{!Function}
 
The callback function.
opt_scope:
{Object=} [optional]
 
An optional scope for the callback function

Event Details

update: {H.util.Event}

Event fired when this provider's data updates.