Class: Layer

H.map.layer.Layer

new H.map.layer.Layer (opt_options)

The Layer class represents an object that is evaluated by the renderer in the order in which it is added to the collection of map layers. It provides the basic infrastructure for dispatching update events to the renderer when new data is available.

A layer is defined by a minimum and maximum zoom level for which it can provide data to the renderer and a projection it uses to transform geographic coordinates into 2D projected world coordinates.

Name Type Description
opt_options H.map.layer.Layer.Options optional

An optional configuration object

Extends

Members

max number

This property holds a value of the maximum zoom level at which the given layer can be rendered.

min number

This property holds the value of the minimum zoom level at which the given layer can be rendered.

pixelProjection H.geo.PixelProjection non-null

This property indicates the projection type for the given layer.

Methods

addEventListener (type, handler, opt_capture, opt_scope) inherited

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.

Name Type Description
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

addOnDisposeCallback (callback, opt_scope) inherited

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

Name Type Description
callback function

The callback function.

opt_scope Object optional

An optional scope for the callback function

dispatchEvent (evt) inherited

This method dispatches an event on the EventTarget object.

Name Type Description
evt H.util.Event | string

An object representing the event or a string with the event name

dispose () inherited

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.

getCopyrights (boundingBox, 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.

Name Type Description
boundingBox H.geo.Rect

The bounding box for which to retrieve the copyright information

level number

The zoom level for which to retrieve the copyright information

Returns:
Type Description
Array.<!H.map.ICopyright> A list of copyright information objects for the provided area and zoom level

getProvider ()H.map.provider.Provider

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

Returns:
Type Description
H.map.provider.Provider this layer's provider

isValid (zoomLevel)boolean

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

Name Type Description
zoomLevel number

The zoom level to check

Returns:
Type Description
boolean true if the given layer can provide data for the zoom level, otherwise false

removeEventListener (type, handler, opt_capture, opt_scope) inherited

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

Name Type Description
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 object defining the scope for the handler function

setMax (max)H.map.layer.Layer

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

Name Type Description
max number

The new maximum zoom level for the given layer

Throws:

if the max parameter is not a number or if it is smaller that the current minimum zoom level

Type
H.lang.InvalidArgumentError
Returns:
Type Description
H.map.layer.Layer An object representing the given layer

setMin (min)H.map.layer.Layer

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

Name Type Description
min number

The new minimum zoom level for the given layer

Throws:

if the min parameter is not a number or if it is larger that the current maximum zoom level

Type
H.lang.InvalidArgumentError
Returns:
Type Description
H.map.layer.Layer An object representing the given layer

Type Definitions

H.map.layer.Layer.Options Object

This object encapsulates options which can be used when creating new layer object.

Properties:
Name Type Argument Description
min number <optional>

The minimum zoom level for which the layer is considered for rendering, the default is 0

max number <optional>

The maximum zoom level for which the layer is considered for rendering, the default is 22

dark boolean <optional>

Indicates whether the content of the given layer is mainly dark, the default is false See also H.Map.Options#autoColor

projection H.geo.IProjection <optional>

The projection to be used for the given layer, the default is H.geo.mercator

minWorldSize number <optional>

The minimal world size at zoom level 0, the default is 256

provider H.map.provider.Provider <optional>

The provider that provides data for the given layer.

Events

update

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

Type: