Guidesv3.2 API Referencev3.1 API Reference

Class: Platform

Class: Platform

Class: Platform

H.service.Platform

new H.service.Platform (options)

Platform is a central class from which all other service stubs are created. It contains the shared settings to be passed to the individual service stubs, for example the root URL of the platform, application credentials, etc.

Name Type Description
options H.service.Platform.Options

Contains configuration options

Throws:
Example
var platform = new H.service.Platform({
  apikey: '{YOUR_API_KEY}', // set your apikey
});

var searchService = platform.getSearchService();
// Now you are ready to talk to the HERE Search API

// It's also possible to re-configure a set of services in one go,
// passing their options combined in the "servicesConfig" option.
// Keys of that dictionary should be taken from "CONFIG_KEY" of corresponding services.
var customPlatform = new H.service.Platform({
  apikey: '{YOUR_API_KEY}',
  servicesConfig: {
    [H.service.SearchService.CONFIG_KEY]: {
      // all defaults are replaced by "baseUrl" if it's specified
      baseUrl: new H.service.Url('https', 'custom.search.example.org')
    },

    [H.service.RoutingService8.CONFIG_KEY]: {
      subDomain: 'routing',
      path: 'custom/path'
    }
  }
});
var customSearchService = customPlatform.getSearchService();
var customRoutingService = customPlatform.getRoutingService();

Methods

createDefaultLayers (opt_params)H.service.Platform.DefaultLayers

This method creates a pre-configured set of HERE layers for convenient use with the map. More details about the used map content services can be found at:

This:
Name Type Description
opt_params H.service.Platform.DefaultLayersOptions optional

It represents the configuration options for the layers.

Returns:
Type Description
H.service.Platform.DefaultLayers An object with the set of layers.
Example
// Create the default layers
var layers = platform.createDefaultLayers({pois: true});

// Add traffic overlay to the map
map.addLayer(layers.vector.traffic.map);

createHybridLayers (styleConfig, onSuccess, onError)

This method creates hybrid map layers. A hybrid map consists of raster satellite base layer and vector layers on top. Layers created by this method can be used only when the Map is instantiated with H.Map.EngineType.HARP engineType. See: H.Map.Options.

Name Type Description
styleConfig Object | string

The hybrid style configuration. Can be either a configuration object or URL to the configuration. The URL can be absolute or relative, but must end with .json extension.

onSuccess function(!Object.<string, !H.map.layer.TileLayer>)

A callback function to be called once layers are successfully created. A callback accepts an object with 3 layers: raster, vector and traffic.

onError function(Error)

A callback function to be called if an error occurs during the layers creation.

Example
const hybridStyleConfig = {
  "base": {
    "style": "oslo",
    "scheme": "hybrid.day"
  },
  "definitions": {
    "Street.Category0.Color": "#ff0000",
    "Satellite.Texture.Gamma": 1.2,
    "Satellite.Texture.Brightness": 0.7
  }
};
platform.createHybridLayers(hybridStyleConfig, (layers) => {
  map.setBaseLayer(layers.raster);
  map.addLayer(layers.vector);
  map.addLayer(layers.traffic)
}, console.error);

createService (Service, opt_options)H.service.Service

This method creates an instance of a given service class, configured with options that are based on defaults and supplied overrides.

Name Type Description
Service function(Object=)

The constructor of the service to instantiate

opt_options Object optional

Contains configuration options for a given service

Returns:
Type Description
H.service.Service An service instance

getBaseUrl ()H.service.Url

To obtain the currently used base URL.

Returns:
Type Description
H.service.Url The current base URL

getGeofencingService (opt_options)H.service.GeofencingService

To create a new instance of H.service.GeofencingService to query the HERE Geofencing API v8.

Name Type Description
opt_options H.service.Options optional

Configuration options for the HERE Geofencing service

Throws:
Returns:
Type Description
H.service.GeofencingService The geofencing service instance.

getIMLService (opt_options)H.service.iml.Service

This method returns an instance of H.service.iml.Service to query the HERE Interactive Map Layer Data API.

Name Type Description
opt_options H.service.iml.Service.Options optional

Configuration options for the IML service.

Returns:
Type Description
H.service.iml.Service The created IML service instance.

getOMVService (opt_options)H.service.omv.Service

To create a new instance of H.service.omv.Service to query data from the HERE Optimized Map Visualization (OMV) endpoint.

This:
Name Type Description
opt_options H.service.omv.Service.Options optional

Configuration options for OMV service

Returns:
Type Description
H.service.omv.Service The created OMV service instance

getPublicTransitService (opt_options)H.service.publicTransit.Service

This method returns an instance of H.service.publicTransit.Service to query the HERE Public Transit API.

Name Type Description
opt_options H.service.Options optional

Configuration options for Public Transit service.

Returns:
Type Description
H.service.publicTransit.Service The created Public Transit service instance.

getRasterTileService (opt_options)H.service.rasterTile.Service

To create a new instance of H.service.rasterTile.Service to query data from the HERE Raster Tile API endpoint.

Name Type Description
opt_options H.service.rasterTile.Service.Options optional

Configuration options for Raster Tile Service

Returns:
Type Description
H.service.rasterTile.Service The created Raster Tile Service instance

getRoutingService (opt_options)H.service.RoutingService8

To create a new instance of H.service.RoutingService8 to query the Routing API v8.

Name Type Description
opt_options H.service.Options optional

Configuration options for routing service

Returns:
Type Description
H.service.RoutingService8 The corresponding routing service instance.

getSearchService (opt_options)H.service.SearchService

To create a new instance of H.service.SearchService to query the Geocoding and Search API endpoints.

Name Type Description
opt_options H.service.Options optional

Configuration options for the Search service

Returns:
Type Description
H.service.SearchService The created SearchService instance

getTrafficService (opt_options)H.service.traffic.Service7

This method returns an instance of H.service.traffic.Service7 to query the Traffic API v7.

Name Type Description
opt_options H.service.Options optional

Configuration options for traffic service.

Returns:
Type Description
H.service.traffic.Service7 The corresponding traffic service instance.

getTrafficVectorTileService (opt_options)H.service.trafficVectorTile.Service

Creates a new instance of H.service.trafficVectorTile.Service to query data from the HERE Traffic Vector Tile API.

Name Type Description
opt_options H.service.trafficVectorTile.Service.Options optional

Configuration options for service

Returns:
Type Description
H.service.trafficVectorTile.Service The created service instance

getVenuesService (options)H.venues.Service | H.venues.Service

To create a new instance of H.venues.Service to query the Venues service.

Name Type Description
options H.venues.Service.Options

Configuration options for the Venues service

Returns:
Type Description
H.venues.Service | H.venues.Service The created Service instance

getWaypointsSequenceService (options)H.service.WaypointsSequenceService

Create a new instance of H.service.WaypointsSequenceService to query the Waypoints Sequence API at HERE Waypoints Sequence API v8

Name Type Description
options H.service.Options optional

Configuration options for Waypoints Sequence service

Throws:
Returns:
Type Description
H.service.WaypointsSequenceService The corresponding Waypoints Sequence service instance.

setBaseUrl (baseUrl)

To set the base URL to be used when creating service stubs.

Name Type Description
baseUrl H.service.Url

The new base URL to use

Type Definitions

H.service.Platform.DefaultLayers Object

This type specifies a collection of pre-configured HERE layers.

Please note that the following layers provide additional premium content like vehicle restrictions and additional POI categories to support the transportation and logistics use case:

  • vector.normal.logistics
  • vector.normal.logisticsnight
  • hybrid.logistics.vector
  • hybrid.logisticsnight.vector
This premium content is classified as transactions under the 'Advanced Vector Tile' category in the HERE Map Rendering system.
For more details on premium content and pricing, please refer to HERE Vector Tile API - Advanced layers

Layer Type Description
vector.normal.map H.map.layer.TileLayer Map with all features and labels
vector.normal.mapnight H.map.layer.TileLayer Map in night mode with all features and labels
vector.normal.lite H.map.layer.TileLayer Reduced map with all features and labels
vector.normal.litenight H.map.layer.TileLayer Reduced map in night mode with all features and labels
vector.normal.roadnetwork H.map.layer.TileLayer Road network map
vector.normal.roadnetworknight H.map.layer.TileLayer Road network map in night mode
vector.normal.logistics H.map.layer.TileLayer Map style tailored for route planning, navigation, and logistics operations
vector.normal.logisticsnight H.map.layer.TileLayer Map style tailored for route planning, navigation, and logistics operations in night mode
vector.normal.topo H.map.layer.TileLayer Topographic map with hill shading and contours
vector.normal.toponight H.map.layer.TileLayer Topographic map with hill shading and contours in night mode
vector.traffic.map H.map.layer.TileLayer Overlay with traffic flow and incidents markers
vector.traffic.mapnight H.map.layer.TileLayer Overlay with traffic flow and incidents markers adapted to the map in night mode
vector.traffic.lite H.map.layer.TileLayer Overlay with traffic flow and incidents markers adapted to the reduced map
vector.traffic.litenight H.map.layer.TileLayer Overlay with traffic flow and incidents markers adapted to the reduced map in night mode
vector.traffic.logistics H.map.layer.TileLayer Overlay with traffic flow and incidents markers compatible with the logistics map
vector.traffic.topo H.map.layer.TileLayer Overlay with traffic flow and incidents markers compatible with the topographic map
vector.traffic.toponight H.map.layer.TileLayer Overlay with traffic flow and incidents markers compatible with the topographic map in night mode
raster.normal.map H.map.layer.TileLayer Map with all features and labels
raster.normal.mapnight H.map.layer.TileLayer Map in night mode with all features and labels
raster.normal.base H.map.layer.TileLayer Map without labels
raster.normal.basenight H.map.layer.TileLayer Map in night mode without labels
raster.normal.labels H.map.layer.TileLayer Transparent map with labels only
raster.satellite.map H.map.layer.TileLayer Satellite map with all features and labels
raster.satellite.xbase H.map.layer.TileLayer Satellite map without features and labels
raster.satellite.base H.map.layer.TileLayer Satellite map without labels
raster.satellite.labels H.map.layer.TileLayer Transparent map tiles with labels only
raster.terrain.map H.map.layer.TileLayer Terrain map with all features and labels
raster.terrain.base H.map.layer.TileLayer Terrain map without labels
raster.terrain.labels H.map.layer.TileLayer Transparent map tiles with labels only
hybrid.day.raster H.map.layer.TileLayer Satellite map without features and labels with the color correction applied
hybrid.day.vector H.map.layer.TileLayer Features and labels that can be rendered over the satellite map
hybrid.day.traffic H.map.layer.TileLayer Overlay with traffic flow and incidents markers that can be rendered over the satellite map
hybrid.night.raster H.map.layer.TileLayer Satellite map without features and labels with the color correction applied
hybrid.night.vector H.map.layer.TileLayer Features and labels that can be rendered over the satellite map in night mode
hybrid.night.traffic H.map.layer.TileLayer Overlay with traffic flow and incidents markers that can be rendered over the satellite map
hybrid.liteday.raster H.map.layer.TileLayer Satellite map without features and labels with the color correction applied
hybrid.liteday.vector H.map.layer.TileLayer Reduced features and labels that can be rendered over the satellite map
hybrid.liteday.traffic H.map.layer.TileLayer Overlay with traffic flow and incidents markers that can be rendered over the satellite map
hybrid.litenight.raster H.map.layer.TileLayer Satellite map without features and labels with the color correction applied
hybrid.litenight.vector H.map.layer.TileLayer Reduced features and labels that can be rendered over the satellite map in night mode
hybrid.litenight.traffic H.map.layer.TileLayer Overlay with traffic flow and incidents markers that can be rendered over the satellite map
hybrid.logistics.raster H.map.layer.TileLayer Satellite map without features and labels with the color correction applied
hybrid.logistics.vector H.map.layer.TileLayer Reduced features and labels that can be rendered over the satellite map
hybrid.logistics.traffic H.map.layer.TileLayer Overlay with traffic flow and incidents markers that can be rendered over the satellite map
hybrid.logisticsnight.raster H.map.layer.TileLayer Satellite map without features and labels with the color correction applied
hybrid.logisticsnight.vector H.map.layer.TileLayer Reduced features and labels that can be rendered over the satellite map in night mode
hybrid.logisticsnight.traffic H.map.layer.TileLayer Overlay with traffic flow and incidents markers that can be rendered over the satellite map

H.service.Platform.DefaultLayersOptions Object

This type encapsulates options used to create default layers.

Properties:
Name Type Argument Description
tileSize number <optional>

Defines the raster tile size to be queried from the HERE Raster Tile v3. The default is 512

ppi number <optional>

A ppi parameter to use when querying tiles from HERE Raster Tile API v3. The default value is 100 in case of window.devicePixelRatio 1 and 200 in case of window.devicePixelRatio 2 or bigger. See ppi – Query Parameters for more details.

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 Boolean value indicating if POIs are displayed on the map (true), valid for the "HERE Vector Tile API" and "HERE Raster Tile API v3". By default POIs are enabled.

crossOrigin string <optional>
<nullable>

The value to use for the crossOrigin attribute of the tile images, if omitted the attribute is set to "anonymous". For more details see MDN web docs. Note that storing of content is not possible if crossOrigin is defined and the value is neither "anonymous" nor "use-credentials"; see also H.Map#storeContent.

engineType H.Map.EngineType <optional>

The engine type in use, it is used to properly configure the providers default style. Default is H.Map.EngineType.HARP.

politicalView string

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

H.service.Platform.Options Object

This type encapsulates the configuration (initialization) options for an instance of Platform.

Properties:
Name Type Argument Description
apikey string

The application ID to identify the client for the platform services (mandatory).

region string <optional>

The region code to use for the platform. Supported regions are "ROW" (Rest of the World) and "JP" (Japan). Default is "ROW". It can affect both service configuration and endpoint selection, as well as the map styling.

baseUrl H.service.Url <optional>

The base URL of the platform, the default depends on the specified region.

headers Object <optional>

A map of HTTP headers to be sent with each request made by each service (unless headers option is overwritten on a per-service basis).

servicesConfig Object <optional>

A dictionary of configurations for services that are using non-default options. It overrides service's defaults but does not override options explicitly passed to service's constructor.