Guidesv3.2 API Referencev3.1 API Reference

Class: Provider

Class: Provider

Class: Provider

H.service.omv.Provider

new H.service.omv.Provider (service, style, opt_options)

This class represents a provider for continuous fetching of HERE Optimized Map Visualization (OMV) tiles.

Note that as this provider provides vector data, it can be used only with a vector rendering engine (see H.Map.Options#engineType).

Name Type Description
service H.service.omv.Service

An object representing the OMV service.

style H.map.render.Style.<!Object>

The style to use for rendering data provided by the provider.

opt_options H.service.omv.Provider.Options optional

The options to instantiate the provider

Fires:
Throws:

in case of invalid service or style

Type
H.lang.InvalidArgumentError
Example
// Assumption: the platform is instantiated
const config = {
    "base": {
        "style": "oslo",
        "scheme": "normal.day"
    },
    "definitions": {
        "Water.0m.Color": "#fe97aa"
    }
};
map.addLayer(
    new H.map.layer.TileLayer(
        new H.service.omv.Provider(platform.getOMVService(), new H.map.render.harp.Style(config))));

Extends

Members

max number inherited

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.

min number inherited

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.

providesOMV inherited overrides

This method checks whether this provider will provide data in OMV format. A concrete implementation of RemoteTileProvider must override it if it will provide OMV data.

tileSize number inherited

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 512.

uid string inherited

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

uri string inherited

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

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

cancelTile (x, y, z) inherited

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

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

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

Name Type Description
tileKey string

The key identifying the tile

createTileInternal (x, y, z, data, opt_options)H.map.provider.Tile inherited

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

Name Type Description
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:
Type Description
H.map.provider.Tile The created tile

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.

This method retrieves a tile cache of this provider.

Returns:
Type Description
H.util.ICache An object representing a tile cache

getCopyrights (boundingBox, level)Array.<!H.map.ICopyright> inherited overrides

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.

Name Type Description
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:
Type Description
Array.<!H.map.ICopyright> A list of copyright information objects for the provided area and zoom level

getPoliticalView ()string | undefined

Returns geopolitical view of the map data. This method is applicable only if engineType of the provider is set to H.Map.EngineType.HARP.

Returns:
Type Description
string | undefined Geopolitical view in ISO 3166-1 alpha-2 standard.

getStyle ()H.map.render.Style.<!Object>

To obtain the style used for rendering the provider data.

Returns:
Type Description
H.map.render.Style.<!Object>

getStyleInternal ()H.map.render.Style.<!Object> inherited overrides

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

Returns:
Type Description
H.map.render.Style.<!Object>

getTileKey (x, y, z)string inherited overrides

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".

Name Type Description
x number

The x tile coordinate (column)

y number

The y tile coordinate (row)

z number

The tile zoom level

Returns:
Type Description
string A string containing the tile key

getTimeRestriction ()string | Array.<string> | undefined

Returns the current time restriction used to adjust the representation of time restricted map features.

This method is applicable only if the provider's engineType is set to H.Map.EngineType.HARP.

See:
Returns:
Type Description
string | Array.<string> | undefined The current time restriction, if set.

getVehicleSpecs ()H.service.omv.Provider.IVehicleSpecs | undefined

Returns a clone of the current vehicle specifications used for filtering vehicle restrictions on the map.

Returns:
Type Description
H.service.omv.Provider.IVehicleSpecs | undefined The vehicle specification if it was previously set; otherwise undefined.

providesGeoJSON ()boolean inherited

This method checks whether this provider will provide data in GeoJSON format. A concrete implementation of RemoteTileProvider must override it if it will provide GeoJSON data.

Returns:
Type Description
boolean A value indicating if the given provider provides GeoJSON data (true) or not (false)

providesRasters ()boolean inherited

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

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

reload (hard) inherited

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.
Name Type Description
hard boolean

A Boolean flag indicating whether to invalidate in hard mode (true) or in soft mode (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

requestInternal (x, y, z, onResponse, onError, opt_priority)H.util.ICancelable inherited overrides

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

Name Type Description
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((HTMLImageElement|HTMLCanvasElement|ArrayBuffer|Object), *=)

A function which is called when a response arrives

onError function(Error)

A function which is called on a communication error

opt_priority H.util.Job.Priority optional

An optional request priority level

Returns:
Type Description
H.util.ICancelable An object implementing ICancelable

requestTile (x, y, z, cacheOnly)H.map.provider.Tile | undefined inherited

This method requests data for a tile.

Name Type Description
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:
Type Description
H.map.provider.Tile | undefined The tile object if it can be obtained, otherwise undefined

setPoliticalView (politicalView)

Sets geopolitical view of the map data. This method is applicable only if engineType of the provider is set to H.Map.EngineType.HARP.

Name Type Description
politicalView string

The geopolitical view in ISO 3166-1 alpha-2 standard.

setStyle (style)

Sets the style to be used for rendering the provider data.

Name Type Description
style H.map.render.Style.<!Object>

setStyleInternal (style, opt_suppressChangeEvent) inherited

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

Name Type Description
style H.map.render.Style.<!Object>

The style to use for rendering the provider data.

opt_suppressChangeEvent boolean optional

Flag to suppress firing of config change event.

setTimeRestriction (timeRestriction)

Sets the time restriction used to adjust the representation of time restricted map features.

The time restriction must be provided as either a single timestamp string or an array of two such strings representing the start and end of the desired time range. Each timestamp must follow the simplified ISO8601 format: YYYY-MM-DDThh:mm. Specified timestamps are always interpreted as local time; do not include timezone information.

The representation depends on the enabled mode of the vehicle restrictions feature. For additional information, refer to H.map.render.harp.Style#setEnabledFeatures.

This method is applicable only when the provider's engineType is set to H.Map.EngineType.HARP.

For more information on how to use this method, including examples, see the View and apply vehicle restrictions dev guide page.

Name Type Description
timeRestriction string | Array.<string> | undefined

The time restriction to set. Must be a string in the simplified ISO8601 format: YYYY-MM-DDThh:mm, an array of two such strings, or undefined. Specified timestamps are always interpreted as local time; do not include timezone information.

Throws:

in case time is not of type string, Array.<string> or undefined.

Will also throw with [timeRestrictionA,timeRestrictionB] when timeRestrictionA>timeRestrictionB.

Type
H.lang.InvalidArgumentError
Example
// Set a time point 03 Jan 2025 00:00
provider.setTimeRestriction("2025-01-03T00:00");

// Set a time range 03 Jan 2025 03:00 to 11:00
provider.setTimeRestriction(["2025-01-03T03:00", "2025-01-03T11:00"]);

// Unset time restriction
provider.setTimeRestriction();

setVehicleSpecs (vehicleSpecs)

Sets the vehicle specifications for filtering vehicle restrictions on the map.

When a vehicle specification is provided, only the vehicle restrictions violated by the specified attributes will be displayed on the map. Passing undefined will result in displaying all vehicle restrictions.

The vehicleSpecs object must conform to the H.service.omv.Provider.IVehicleSpecs interface. Typical use is to set a truck profile to visualize only relevant restrictions for that vehicle.

This feature is currently in beta and its behavior may change in future releases.

For more information on how to use this method, including examples, see the View and apply vehicle restrictions dev guide page.

In case the vehicleSpecs parameter has defined grossWeightInKilograms but not currentWeightInKilograms, internally the currentWeightInKilograms will be set to the value of grossWeightInKilograms.

In case the vehicleSpecs parameter has defined currentWeightInKilograms but not grossWeightInKilograms, a warning will be logged and internally the grossWeightInKilograms will be set to the value of currentWeightInKilograms.

In case the vehicleSpecs parameter's property grossWeightInKilograms is less than currentWeightInKilograms, a warning will be logged and internally grossWeightInKilograms will be set to the value of currentWeightInKilograms.

Name Type Description
vehicleSpecs H.service.omv.Provider.IVehicleSpecs | undefined

The vehicle specification to set. If undefined, all vehicle restrictions are shown.

Example
provider.setVehicleSpecs({
    vehicleType: H.service.omv.Provider.IVehicleSpecs.VehicleType.TRUCK,
    grossWeightInKilograms: 32000,
    currentWeightInKilograms: 14000,
    heightInCentimeters: 410
  });

Type Definitions

H.service.omv.Provider.Options Object

This object contains configuration options for a TileProvider instance.

Properties:
Name Type Argument Description
uri string <optional>

The provider's unique resource identifier which must not contain an underscore "_". If omitted, an auto-generated unique Session ID is used. If a consistent ID across sessions is needed (for example for storing provider data), this property must be specified.

min number <optional>

The minimum supported zoom level, the default is 2.

max number <optional>

The maximum supported zoom level, the default is 22.

getCopyrights function <optional>

A function to replace the default implementation of H.map.provider.Provider#getCopyrights.

engineType H.Map.EngineType <optional>

The engine type in use, it is used to return the proper format of the provider's default style. Default is H.Map.EngineType.HARP.

tileSize number <optional>

The size of a tile given as edge length in pixels. Its value must be 2^n, where n is in range [0 ... 30], default is 512.

politicalView string <optional>

The geopolitical view of the map data in ISO 3166-1 alpha-2 standard. The default value corresponds to the international geopolitical view.

lg string <optional>

An identifier of the primary language, the default is not specified. A BCP47 language code limited to ISO 639-1 two-letter language code (like "en") and, optionally, ISO 15924 four-letter script code (like "zh-Hant")

lg2 string <optional>

An identifier of the secondary language, the default is not specified. A BCP47 language code limited to ISO 639-1 two-letter language code (like "en") and, optionally, ISO 15924 four-letter script code (like "zh-Hant")

pois boolean <optional>

A value indicating if POIs are displayed on the map true. By default POIs are disabled.

vehicleSpecs H.service.omv.Provider.IVehicleSpecs <optional>

The vehicle specifications to use when rendering the map with vehicle restrictions enabled. This feature is currently in beta and its behaviour may change in future releases. For more information on this property, including examples, see the View and apply vehicle restrictions dev guide page.

timeRestriction string | Array.<string> <optional>

The time which is used to adjust the representation of time restricted map features. For more information on this property, including examples, see the View and apply vehicle restrictions dev guide page.

Interface Definitions

H.service.omv.Provider.ITruckSpecs

This interface represents the specifications of a vehicle of type truck.

H.service.omv.Provider.IVehicleSpecs

This interface represents the specifications of a vehicle. Used to filter map restrictions relevant to a specific vehicle profile.

Events

configchange inherited

Fired when the provider's style (which is used to render the provider's data) changes. If applicable, the event's newValue and oldValue properties contain the new and old configuration data respectively.

Type:

politicalviewchange

Fired when the geopolitical view changes. The event's newValue and oldValue properties contain the new and old geopolitical view respectively.

Type:
See:

timerestrictionchange

Fired when the time restriction changes The event's newValue and oldValue properties contain the new and old time restriction respectively.

Type:
See:

update inherited

Fired when the provider's data updates.

Type:

vehiclespecschange

Fired when the vehicle specs changes The event's newValue and oldValue properties contain the new and old vehicle specs respectively. The newValue vehicle specs must not be modified directly. Use H.service.omv.Provider#getVehicleSpecs and H.service.omv.Provider#setVehicleSpecs to get, modify and set new vehicle specs instead.

Type:
See: