Maps API for JavaScript Developer's Guide

H.map.layer.BaseTileLayer

Class Summary

Extends: H.map.layer.Layer

BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request management.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

getProvider () : {H.map.provider.TileProvider}

This method returns the provider which feeds this layer with data.

geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}

This method transforms a geo-rectangle to geometrical projected rectangle at the current projection zoom level or at provided zoom level

getTileBounds (rectBounds, zoom) : {H.math.Rect}

This method returns tile grid for a bounding rectangle

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

This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or undefined and starts loading the tile

cancelTile (x, y, z)

This method cancels a previously requested tile.

getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) : {H.map.layer.ITileLayer.Response}

This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be available during subsequent calls.

isValid (zoomLevel) : {boolean}

This method checks if a zoom level can be served by this layer.

setMin (min) : {H.map.layer.Layer}

This method sets the minimum zoom level for which this layer will provide tiles.

setMax (max) : {H.map.layer.Layer}

This method sets the maximum zoom level for which this layer will provide tiles.

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

This method returns the copyright of the current data provider.

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible.

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

Events Summary

Table 2. Events
Events

update : {H.util.Event}

Fired when this layer's data updates

minchange : {H.util.ChangeEvent}

Fired when this layer's minimum zoom level changes.

maxchange : {H.util.ChangeEvent}

Fired when this layer's maximum zoom level changes.

Class Description

BaseTileLayer encapsulates funcitonailty that is common to all layers that deliver tiles, such as H.map.layer.TileLayer. The functionality includes geo bounding box to grid calculation, tile request management.

Constructor Details

H.map.layer.BaseTileLayer(provider, opt_options)

Parameters:
 
provider:
{H.map.provider.TileProvider}
 
data source for the TileLayer
opt_options:
{H.map.layer.ITileLayer.Options=} [optional]
 
additional options

Method Details

getProvider () : {H.map.provider.TileProvider}

This method returns the provider which feeds this layer with data.

Returns:
 
{H.map.provider.TileProvider}
this layer's provider

geoRectToRect (geoRect, opt_zoom) : {H.math.Rect}

This method transforms a geo-rectangle to geometrical projected rectangle at the current projection zoom level or at provided zoom level

Parameters:
 
geoRect:
{H.geo.Rect}
 
geo bounds to be projected
opt_zoom:
{number=} [optional]
 
overrides current projection zoom level
Returns:
 
{H.math.Rect}
projected 2d space rect cooresponding to provided geo bounds

getTileBounds (rectBounds, zoom) : {H.math.Rect}

This method returns tile grid for a bounding rectangle

Parameters:
 
rectBounds:
{H.math.Rect}
 
projected rect bounds which coorespond to geo bounding box
zoom:
{number}
 
current zoom level
Returns:
 
{H.math.Rect}
rectangle which represents the tile grid bounds

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

This method requests a single tile according to tile coordinates. It returns either a Tile object if it is already loaded or undefined and starts loading the tile

Parameters:
 
x:
{number}
 
tile row position
y:
{number}
 
tile column position
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 corresponding to requested coordinates

cancelTile (x, y, z)

This method cancels a previously requested tile.

Parameters:
 
x:
{number}
 
tile row position
y:
{number}
 
tile column position
z:
{number}
 
zoom level

getProviderTiles (tileBounds, isCDB, zoomLevel, cacheOnly, prioCenter) : {H.map.layer.ITileLayer.Response}

This method requests tiles from the data source (provider). It can return a set of tiles which are currently loaded. All tiles which are not yet loaded will be included in response as soon as they will be available during subsequent calls.

Parameters:
 
tileBounds:
{H.math.Rect}
 
bounds in tile grid
isCDB:
{boolean}
 
zoomLevel:
{number}
 
The zoom level for which the objects are requested
cacheOnly:
{boolean}
 
Indicates whether only cached objects are to be considered
prioCenter:
{H.math.Point}
 
The priority center as an offset in screen pixel relative to the center
Returns:
 
{H.map.layer.ITileLayer.Response}
returns an array if tile which are already loaded

isValid (zoomLevel) : {boolean}

This method checks if a zoom level can be served by this layer.

Parameters:
 
zoomLevel:
{number}
 
the zoom level to check
Returns:
 
{boolean}
true if this layer can provide data for the zoom level, otherwise false

setMin (min) : {H.map.layer.Layer}

This method sets the minimum zoom level for which this layer will provide tiles.

Parameters:
 
min:
{number}
 
The new minimum zoom level of this layer
Returns:
 
{H.map.layer.Layer}
Returns this instance of the layer

setMax (max) : {H.map.layer.Layer}

This method sets the maximum zoom level for which this layer will provide tiles.

Parameters:
 
max:
{number}
 
The new maximum zoom level of this layer
Returns:
 
{H.map.layer.Layer}
Returns this instance of the layer

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

This method returns the copyright of the current data provider.

Note: This function must be overridden by any class inheriting layer. 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

addEventListener (type, handler, opt_capture, opt_scope)

This method allows to listen for specific event triggered by the object. Keep in mind, that you must removeEventListener manually or dispose an object when you no longer need it. Otherwise memory leak is possible.

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}
 
The callback function.
opt_scope:
{Object=} [optional]
 
An optional scope to call the callback in.

Event Details

update: {H.util.Event}

Fired when this layer's data updates

minchange: {H.util.ChangeEvent}

Fired when this layer's minimum zoom level changes.

Deprecated:
since 3.0.7.0

maxchange: {H.util.ChangeEvent}

Fired when this layer's maximum zoom level changes.

Deprecated:
since 3.0.7.0

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.