Maps API for JavaScript Developer's Guide

H.map.layer.ObjectLayer

Class Summary

Implements: H.map.layer.ITileLayer

Implements: H.map.layer.IMarkerLayer

Extends: H.map.layer.Layer

This class represents a layer which renders map objects. Spatial objects such as polygons and polylines are rendered to tiles before being passed to the rendering engine. Point objects such as markers are provided as objects given an rectangular area.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

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

This method returns current ObjectLayer's data provider

requestOverlays (bounds, zoomLevel, cacheOnly, prioCenter) : {H.map.layer.ObjectLayer.OverlaysResponse}

This method retrieves overlay objects contained in a bounding rectangle.

requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) : {H.map.layer.ITileLayer.Response}

This method requests tiles for a specific bounding rectangle and zoom level (z-value).

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

This method requests a single tile for the specified tile coordinates.

cancelTile (x, y, z)

This method cancels a previously requested tile.

requestMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) : {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}

This method requests marker objects for a bounding rectangle.

requestDomMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) : {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}

This method requests DOM marker objects for a bounding rectangle.

isValid (zoomLevel) : {boolean}

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

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

This method sets the minimum zoom level at which the given layer provides content.

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

This method sets the maximum zoom level at which the given layer provides content.

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

This method retrieves the copyright of the current data provider.

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 2. Events
Events

update : {H.util.Event}

Event fired when the data associated with the given layer is updated.

minchange : {H.util.ChangeEvent}

Event fired when the minimum zoom level for the given layer changes.

maxchange : {H.util.ChangeEvent}

Event fired when the maximum zoom level for the given layer changes.

Class Description

This class represents a layer which renders map objects. Spatial objects such as polygons and polylines are rendered to tiles before being passed to the rendering engine. Point objects such as markers are provided as objects given an rectangular area.

Constructor Details

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

Parameters:
 
provider:
{H.map.provider.ObjectProvider}
 
The ObjectProvider which provides the map objects to the given object layer.
opt_options:
{H.map.layer.ObjectLayer.Options=} [optional]
 
An object containing the initialization options for the given layer

Method Details

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

This method returns current ObjectLayer's data provider

requestOverlays (bounds, zoomLevel, cacheOnly, prioCenter) : {H.map.layer.ObjectLayer.OverlaysResponse}

This method retrieves overlay objects contained in a bounding rectangle.

Parameters:
 
bounds:
{H.geo.Rect}
 
The bounding rectangle for which overlays are to be returned
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.ObjectLayer.OverlaysResponse}
An object containing all overlays in the bounding rectangle

requestTiles (boundingRect, zoomLevel, cacheOnly, prioCenter) : {H.map.layer.ITileLayer.Response}

This method requests tiles for a specific bounding rectangle and zoom level (z-value).

An implementing object must calculate the tile grid which intersects with the bounding rectangle. An ITileLayer does not need to return all tiles immediately (as loading tile data from remote sources may be asynchronous). The implementing object may return a partial response if the full response cannot be synchronously provided to the renderer.

The response object returned by this method must contain the number of tiles which intersect with the bounding rectangle at the zoom level specified by the caller.

This method is called by the renderer for each rendering cycle. An implementing object must make sure that calling this method does not impede the rendering process, therefore caching of remote objects is strongly advised.

Parameters:
 
boundingRect:
{H.geo.Rect}
 
the bounding rectangle for which tiles are to be returned
zoomLevel:
{number}
 
The zoom level for which the tiles are requested
cacheOnly:
{boolean}
 
Indicates whether only cached tiles are to be considered (true)
prioCenter:
{H.math.Point}
 
The priority center as an offset in screen pixel relative to the center
Returns:
 
{H.map.layer.ITileLayer.Response}
A response object containing the total number of tiles requested and the tile objects that could be immediately returned

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

This method requests a single tile for the specified tile coordinates.

Parameters:
 
x:
{number}
 
Tile row position
y:
{number}
 
Tile column position
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
Returns:
 
{(H.map.provider.Tile | undefined)}
A tile object matching the supplied coordinates if the tile is already loaded, otherwise the method starts loading the tile and returns undefined

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

requestMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) : {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}

This method requests marker objects for a bounding rectangle.

The implementation of this method must return all marker objects which are contained within the bounding rectangle.

The response object returned by this method must contain the number of objects which intersect with the bounding rectangle.

This method is called by the renderer in each rendering cycle. An implementing object must make sure that calling this method does not impede the rendering process.

Parameters:
 
boundingRect:
{H.geo.Rect}
 
The bounding rectangle for which marker are to be retrieved
zoomLevel:
{number}
 
The zoom level for which the objects are requested
cacheOnly:
{boolean}
 
A value indicating whether only cached objects are to be considered true
prioCenter:
{H.math.Point}
 
The priority center as an offset in screen pixels relative to the center
Returns:
 
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
A response object containing the number of markers and the markers themselves

requestDomMarkers (boundingRect, zoomLevel, cacheOnly, prioCenter) : {(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}

This method requests DOM marker objects for a bounding rectangle.

The implementation of this method must return all DOM marker objects which are contained within the bounding rectangle.

The response object returned by this method must contain the number of objects which intersect with the bounding rectangle.

This method is called by the renderer in each rendering cycle. An implementing object must make sure that calling this method does not impede the rendering process.

Parameters:
 
boundingRect:
{H.geo.Rect}
 
The bounding rectangle for which marker are to be retrieved
zoomLevel:
{number}
 
The zoom level for which the objects are requested
cacheOnly:
{boolean}
 
A value indicating whether only cached objects are to be considered true
prioCenter:
{H.math.Point}
 
The priority center as an offset in screen pixel relative to the center
Returns:
 
{(H.map.layer.IMarkerLayer.Response | H.map.layer.IMarkerLayer.TiledResponse)}
a response object containing the number of markers and the markers themselves

isValid (zoomLevel) : {boolean}

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

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

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

This method sets the minimum zoom level at which the given layer provides content.

Parameters:
 
min:
{number}
 
The new minimum zoom level for the given layer
Returns:
 
{H.map.layer.Layer}
An object representing the given layer
Throws:
 
{H.lang.InvalidArgumentError}
 
Throws an exception if the min parameter is not a number or if it is larger that the current maximum zoom level

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

This method sets the maximum zoom level at which the given layer provides content.

Parameters:
 
max:
{number}
 
The new maximum zoom level for the given layer
Returns:
 
{H.map.layer.Layer}
An object representing the given layer
Throws:
 
{H.lang.InvalidArgumentError}
 
Throws an exception if the max parameter is not a number or if it is smaller that the current minimum zoom level

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

This method retrieves the copyright of the current data provider.

Note: This function must be overridden by any class derived from 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 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 the data associated with the given layer is updated.

minchange: {H.util.ChangeEvent}

Event fired when the minimum zoom level for the given layer changes.

Deprecated:
since 3.0.7.0

maxchange: {H.util.ChangeEvent}

Event fired when the maximum zoom level for the given layer 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.