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_paramsH.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); -
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.HARPengineType. See:H.Map.Options.Name Type Description styleConfigObject | 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
.jsonextension.onSuccessfunction(!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,vectorandtraffic.onErrorfunction(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 Servicefunction(Object=) The constructor of the service to instantiate
opt_optionsObject 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.GeofencingServiceto query the HERE Geofencing API v8.Name Type Description opt_optionsH.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.Serviceto query the HERE Interactive Map Layer Data API.Name Type Description opt_optionsH.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.Serviceto query data from the HERE Optimized Map Visualization (OMV) endpoint.This:
Name Type Description opt_optionsH.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.Serviceto query the HERE Public Transit API.Name Type Description opt_optionsH.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.Serviceto query data from the HERE Raster Tile API endpoint.Name Type Description opt_optionsH.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.RoutingService8to query the Routing API v8.Name Type Description opt_optionsH.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.SearchServiceto query the Geocoding and Search API endpoints.Name Type Description opt_optionsH.service.Options optional Configuration options for the Search service
Returns:
Type Description H.service.SearchService The created SearchServiceinstance -
getTrafficService (opt_options)H.service.traffic.Service7
-
This method returns an instance of
H.service.traffic.Service7to query the Traffic API v7.Name Type Description opt_optionsH.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.Serviceto query data from the HERE Traffic Vector Tile API.Name Type Description opt_optionsH.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.Serviceto query the Venues service.Name Type Description optionsH.venues.Service.Options Configuration options for the Venues service
Returns:
Type Description H.venues.Service | H.venues.Service The created Serviceinstance -
getWaypointsSequenceService (options)H.service.WaypointsSequenceService
-
Create a new instance of
H.service.WaypointsSequenceServiceto query the Waypoints Sequence API at HERE Waypoints Sequence API v8Name Type Description optionsH.service.Options optional Configuration options for Waypoints Sequence service
Throws:
Returns:
Type Description H.service.WaypointsSequenceService The corresponding Waypoints Sequence service instance. -
To set the base URL to be used when creating service stubs.
Name Type Description baseUrlH.service.Url The new base URL to use
Type Definitions
-
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.logisticsvector.normal.logisticsnighthybrid.logistics.vectorhybrid.logisticsnight.vector
For more details on premium content and pricing, please refer to HERE Vector Tile API - Advanced layersLayer Type Description vector.normal.map H.map.layer.TileLayerMap with all features and labels vector.normal.mapnight H.map.layer.TileLayerMap in night mode with all features and labels vector.normal.lite H.map.layer.TileLayerReduced map with all features and labels vector.normal.litenight H.map.layer.TileLayerReduced map in night mode with all features and labels vector.normal.roadnetwork H.map.layer.TileLayerRoad network map vector.normal.roadnetworknight H.map.layer.TileLayerRoad network map in night mode vector.normal.logistics H.map.layer.TileLayerMap style tailored for route planning, navigation, and logistics operations vector.normal.logisticsnight H.map.layer.TileLayerMap style tailored for route planning, navigation, and logistics operations in night mode vector.normal.topo H.map.layer.TileLayerTopographic map with hill shading and contours vector.normal.toponight H.map.layer.TileLayerTopographic map with hill shading and contours in night mode vector.traffic.map H.map.layer.TileLayerOverlay with traffic flow and incidents markers vector.traffic.mapnight H.map.layer.TileLayerOverlay with traffic flow and incidents markers adapted to the map in night mode vector.traffic.lite H.map.layer.TileLayerOverlay with traffic flow and incidents markers adapted to the reduced map vector.traffic.litenight H.map.layer.TileLayerOverlay with traffic flow and incidents markers adapted to the reduced map in night mode vector.traffic.logistics H.map.layer.TileLayerOverlay with traffic flow and incidents markers compatible with the logistics map vector.traffic.topo H.map.layer.TileLayerOverlay with traffic flow and incidents markers compatible with the topographic map vector.traffic.toponight H.map.layer.TileLayerOverlay with traffic flow and incidents markers compatible with the topographic map in night mode raster.normal.map H.map.layer.TileLayerMap with all features and labels raster.normal.mapnight H.map.layer.TileLayerMap in night mode with all features and labels raster.normal.base H.map.layer.TileLayerMap without labels raster.normal.basenight H.map.layer.TileLayerMap in night mode without labels raster.normal.labels H.map.layer.TileLayerTransparent map with labels only raster.satellite.map H.map.layer.TileLayerSatellite map with all features and labels raster.satellite.xbase H.map.layer.TileLayerSatellite map without features and labels raster.satellite.base H.map.layer.TileLayerSatellite map without labels raster.satellite.labels H.map.layer.TileLayerTransparent map tiles with labels only raster.terrain.map H.map.layer.TileLayerTerrain map with all features and labels raster.terrain.base H.map.layer.TileLayerTerrain map without labels raster.terrain.labels H.map.layer.TileLayerTransparent map tiles with labels only hybrid.day.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied hybrid.day.vector H.map.layer.TileLayerFeatures and labels that can be rendered over the satellite map hybrid.day.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map hybrid.night.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied hybrid.night.vector H.map.layer.TileLayerFeatures and labels that can be rendered over the satellite map in night mode hybrid.night.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map hybrid.liteday.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied hybrid.liteday.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map hybrid.liteday.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map hybrid.litenight.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied hybrid.litenight.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map in night mode hybrid.litenight.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map hybrid.logistics.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied hybrid.logistics.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map hybrid.logistics.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map hybrid.logisticsnight.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied hybrid.logisticsnight.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map in night mode hybrid.logisticsnight.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map -
This type encapsulates options used to create default layers.
Properties:
Name Type Argument Description tileSizenumber <optional>
Defines the raster tile size to be queried from the HERE Raster Tile v3. The default is
512ppinumber <optional>
A
ppiparameter to use when querying tiles from HERE Raster Tile API v3. The default value is100in case of window.devicePixelRatio1and200in case of window.devicePixelRatio2or bigger. See ppi – Query Parameters for more details.lgstring <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")lg2string <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")poisboolean <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.crossOriginstring <optional>
<nullable>
The value to use for the
crossOriginattribute 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 ifcrossOriginis defined and the value is neither"anonymous"nor"use-credentials"; see alsoH.Map#storeContent.engineTypeH.Map.EngineType <optional>
The engine type in use, it is used to properly configure the providers default style. Default is
H.Map.EngineType.HARP.politicalViewstring The geopolitical view of the map data in ISO 3166-1 alpha-2 standard. The default value corresponds to the international geopolitical view.
-
This type encapsulates the configuration (initialization) options for an instance of
Platform.Properties:
Name Type Argument Description apikeystring The application ID to identify the client for the platform services (mandatory).
regionstring <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.baseUrlH.service.Url <optional>
The base URL of the platform, the default depends on the specified region.
headersObject <optional>
A map of HTTP headers to be sent with each request made by each service (unless
headersoption is overwritten on a per-service basis).servicesConfigObject <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.