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 geocoder = platform.getGeocodingService();
// Now you are ready to talk to the HERE Geocoder 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.GeocodingService.CONFIG_KEY]: {
// all defaults are replaced by "baseUrl" if it's specified
baseUrl: new H.service.Url('https', 'custom.geocoder.example.org')
},
[H.service.RoutingService.CONFIG_KEY]: {
subDomain: 'routing',
path: 'custom/path'
}
}
});
var customGeocoder = customPlatform.getGeocodingService();
var customRouting = customPlatform.getRoutingService();
Methods
-
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:
Name Type Description opt_tileSizeH.service.Platform.DefaultLayersOptions | number optional If this parameter is a number, it indicates the tile size to be queried from the "HERE Map Tile API v2" or "HERE Raster Tile API v3" (the default value is
512); if this parameter is an object, it represents configuration options for the layer and all the remaining parameters (below) should be omittedopt_ppinumber optional An optional
ppiparameter to use when querying tiles, the default is not specified. See Base Map Tile – Optional Query Parameters for more details. For layers with raster tiles from HERE Raster Tile API v3 a value > 72 means, that tiles designed for 200 ppi are used, otherwise 100 ppi.opt_langstring optional An identifier of the primary language parameter, the default is not specified
opt_secondaryLangstring optional An identifier of the secondary language parameter, the default is not specified
opt_stylestring optional An optional 'style' parameter to use when querying map tiles, the default is not specified
opt_poisstring | boolean optional A Boolean value indicating if POIs are displayed on the map (
true), valid for the "HERE Vector Tile API", "HERE Map Tile API v2" and "HERE Raster Tile API v3". For layers from HERE Map Tile API v2, a string for the POI Categories can be provided as described in the documentation for POI Categories. By default POIs are disabled.Returns:
Type Description Object An object with the set of layers. The set of layers depends on engineTypeproperty ofH.service.Platform.DefaultLayersOptions.
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 layers
Please note that the layervector.normal.truckis deprecated and will stop working in future.
Please switch to theHARPengine (see Migrate to the HARP engine) and make use of the logistics base map style and the feature & modes capabilities.Layer Type Description Supported by H.Map.EngineTypevector.normal.map H.map.layer.TileLayerMap with all features and labels HARP,WEBGLvector.normal.mapnight H.map.layer.TileLayerMap in night mode with all features and labels HARPvector.normal.lite H.map.layer.TileLayerReduced map with all features and labels HARPvector.normal.litenight H.map.layer.TileLayerReduced map in night mode with all features and labels HARPvector.normal.roadnetwork H.map.layer.TileLayerRoad network map HARPvector.normal.roadnetworknight H.map.layer.TileLayerRoad network map in night mode HARPvector.normal.truck H.map.layer.TileLayerMap with all features and labels plus truck information (deprecated) WEBGLvector.normal.traffic H.map.layer.TileLayerTransparent map with traffic flow information (deprecated) WEBGLvector.normal.trafficincidents H.map.layer.MarkerTileLayerTransparent map with traffic incidents markers (deprecated) HARP,WEBGLvector.normal.logistics H.map.layer.TileLayerMap style tailored for route planning, navigation, and logistics operations HARPvector.normal.logisticsnight H.map.layer.TileLayerMap style tailored for route planning, navigation, and logistics operations in night mode HARPvector.normal.topo H.map.layer.TileLayerTopographic map with hill shading and contours HARPvector.normal.toponight H.map.layer.TileLayerTopographic map with hill shading and contours in night mode HARPvector.traffic.map H.map.layer.TileLayerOverlay with traffic flow and incidents markers HARP,WEBGLvector.traffic.mapnight H.map.layer.TileLayerOverlay with traffic flow and incidents markers adapted to the map in night mode HARPvector.traffic.lite H.map.layer.TileLayerOverlay with traffic flow and incidents markers adapted to the reduced map HARPvector.traffic.litenight H.map.layer.TileLayerOverlay with traffic flow and incidents markers adapted to the reduced map in night mode HARPvector.traffic.logistics H.map.layer.TileLayerOverlay with traffic flow and incidents markers compatible with the logistics map HARPvector.traffic.topo H.map.layer.TileLayerOverlay with traffic flow and incidents markers compatible with the topographic map HARPvector.traffic.toponight H.map.layer.TileLayerOverlay with traffic flow and incidents markers compatible with the topographic map in night mode HARPraster.normal.map H.map.layer.TileLayerMap with all features and labels HARP,WEBGL,P2Draster.normal.mapnight H.map.layer.TileLayerMap in night mode with all features and labels HARP,WEBGL,P2Draster.normal.xbase H.map.layer.TileLayerMap without features and labels HARP,WEBGL,P2Draster.normal.xbasenight H.map.layer.TileLayerMap in night mode without features and labels HARP,WEBGL,P2Draster.normal.base H.map.layer.TileLayerMap without labels HARP,WEBGL,P2Draster.normal.basenight H.map.layer.TileLayerMap in night mode without labels HARP,WEBGL,P2Draster.normal.trafficincidents H.map.layer.MarkerTileLayerTransparent map with traffic incidents markers (deprecated) HARP,WEBGL,P2Draster.normal.transit H.map.layer.TileLayerMap with public transport lines (deprecated) HARP,WEBGL,P2Draster.normal.labels H.map.layer.TileLayerTransparent map with labels only HARP,WEBGL,P2Draster.normal.metaInfo H.map.layer.TileLayerMetadata information about raster tiles P2Draster.satellite.map H.map.layer.TileLayerSatellite map with all features and labels HARP,WEBGL,P2Draster.satellite.xbase H.map.layer.TileLayerSatellite map without features and labels HARP,WEBGL,P2Draster.satellite.base H.map.layer.TileLayerSatellite map without labels HARP,WEBGL,P2Draster.satellite.labels H.map.layer.TileLayerTransparent map tiles with labels only HARP,WEBGL,P2Draster.terrain.map H.map.layer.TileLayerTerrain map with all features and labels (deprecated with WEBGLandP2D)HARP,WEBGL,P2Draster.terrain.xbase H.map.layer.TileLayerTerrain map without features and labels (deprecated) HARP,WEBGL,P2Draster.terrain.base H.map.layer.TileLayerTerrain map without labels (deprecated with WEBGLandP2D)HARP,WEBGL,P2Draster.terrain.labels H.map.layer.TileLayerTransparent map tiles with labels only (deprecated with WEBGLandP2D)HARP,WEBGL,P2Dhybrid.day.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied HARPhybrid.day.vector H.map.layer.TileLayerFeatures and labels that can be rendered over the satellite map HARPhybrid.day.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map HARPhybrid.night.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied HARPhybrid.night.vector H.map.layer.TileLayerFeatures and labels that can be rendered over the satellite map in night mode HARPhybrid.night.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map HARPhybrid.liteday.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied HARPhybrid.liteday.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map HARPhybrid.liteday.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map HARPhybrid.litenight.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied HARPhybrid.litenight.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map in night mode HARPhybrid.litenight.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map HARPhybrid.logistics.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied HARPhybrid.logistics.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map HARPhybrid.logistics.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map HARPhybrid.logisticsnight.raster H.map.layer.TileLayerSatellite map without features and labels with the color correction applied HARPhybrid.logisticsnight.vector H.map.layer.TileLayerReduced features and labels that can be rendered over the satellite map in night mode HARPhybrid.logisticsnight.traffic H.map.layer.TileLayerOverlay with traffic flow and incidents markers that can be rendered over the satellite map HARPExample
// 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 should 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 -
getCustomLocationService (opt_options)H.service.extension.customLocation.Service Deprecated : since 3.1.30.12
-
To obtain a new instance of
H.service.extension.customLocation.Serviceto query the HERE Fleet Telematics API endpoints related to creation, modification and retrieval of the custom data layers.Name Type Description opt_optionsH.service.Options optional Configuration options of the service
Returns:
Type Description H.service.extension.customLocation.Service The service instance -
getCustomRoutingService (opt_options)H.service.extension.customRoute.Service Deprecated : since 3.1.30.12
-
To obtain a new instance of
H.service.extension.customRoute.Serviceto query the custom route endpoint of the HERE Fleet Telematics API.Name Type Description opt_optionsH.service.Options optional Configuration options of the service
Returns:
Type Description H.service.extension.customRoute.Service The service instance -
getGeocodingService (opt_options)H.service.GeocodingService Deprecated : since 3.1.30.12
-
To create a new instance of
H.service.GeocodingServiceto query the Geocoder API.Name Type Description opt_optionsH.service.GeocodingService.Options optional Configuration options for geocoding service
Returns:
Type Description H.service.GeocodingService The created GeocodingServiceinstance -
getGeofencingService (opt_options, opt_version)H.service.GeofencingService | H.service.extension.geofencing.Service
-
To create a new instance of either
H.service.extension.geofencing.ServiceorH.service.GeofencingServiceto query the selected Geofencing API. For compatibility reasons the class defaults to the deprecated HERE Fleet Telematics API, new applications should provide the optionalopt_versionparameter to get access to the new HERE Geofencing API v8Name Type Description opt_optionsH.service.Options optional Configuration options for Geofencing service
opt_versionnumber optional Indicates the optional version of the Geofencing API to use, allowed values are
8for the HERE Geofencing API v8 orundefinedfor the deprecated HERE Fleet Telematics API. Default isundefined.Throws:
Returns:
Type Description H.service.GeofencingService | H.service.extension.geofencing.Service The corresponding 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. -
getMapTileService (opt_options)H.service.MapTileService
-
To create a new instance of
H.service.MapTileServiceto query the Map Tile API.Name Type Description opt_optionsH.service.MapTileService.Options optional Configuration options for map tile service
Returns:
Type Description H.service.MapTileService The created map tile service instance -
getMetaInfoService (opt_options)H.service.metaInfo.Service
-
This method returns an instance of
H.service.metaInfo.Serviceto query the Map Tile API Metainfo TilesName Type Description opt_optionsH.service.metaInfo.Service.Options optional Configuration options for meta info service
Returns:
Type Description H.service.metaInfo.Service The created MetaInfo 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.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 -
getPlacesService (opt_options)H.service.PlacesService Deprecated : since 3.1.30.12
-
To create a new instance of
H.service.PlacesServiceto query the Places API.Name Type Description opt_optionsH.service.omv.Service.Options optional Configuration options for places service
Returns:
Type Description H.service.PlacesService The created PlacesServiceinstance -
getPlatformDataService (opt_options)H.service.extension.platformData.Service Deprecated : since 3.1.30.12
-
This method returns an instance of
H.service.extension.platformData.Serviceto query the HERE Fleet Telematics API.Name Type Description opt_optionsH.service.Options optional Configuration options of the service
Returns:
Type Description H.service.extension.platformData.Service The created 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, opt_version)H.service.RoutingService | H.service.RoutingService8
-
To create a new instance of
H.service.RoutingServiceto query the selected Routing API. For compatibility reasons the class defaults to the deprecated Routing API v7, new applications should provide the optionalopt_versionparameter to get access to the new Routing API v8Name Type Description opt_optionsH.service.Options optional Configuration options for routing service
opt_versionnumber optional Indicates the version of the Routing API to use, allowed values are
7for the Routing API v7 and8for the Routing API v8. Default is7.Throws:
Returns:
Type Description H.service.RoutingService | 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, opt_version)H.service.traffic.Service | H.service.traffic.Service7
-
This method returns either an instance of
H.service.traffic.ServiceorH.service.traffic.Service7to query the selected Traffic API.For compatibility reasons the class defaults to the deprecated HERE Traffic API and HERE Traffic Incident Data, new applications should provide the optional
opt_versionparameter to get access to the new Traffic API v7.Name Type Description opt_optionsH.service.traffic.Service.Options | H.service.Options optional Configuration options for traffic service
opt_versionnumber optional Indicates the version of the Traffic API to use, allowed values are
6for the Traffic API v6 and7for the Traffic API v7. Default is6.Throws:
Returns:
Type Description H.service.traffic.Service | 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, opt_version)H.venues.Service | H.venues.Service2
-
To create a new instance of
H.venues.Service2to query the Venues service. For the compatibility reasons the class defaults to the deprecated Venues service, new applications should provide the optional opt_version parameter to get access to the new Venues service.Name Type Description optionsH.venues.Service.Options optional Configuration options for the Venues service
opt_versionnumber.<(1|2)> optional opt_version Indicates the version of the Venue service to use, allowed values are 1 for the legacy Venue service and 2 for the latest Venue service. Default is 1.
Returns:
Type Description H.venues.Service | H.venues.Service2 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 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 Map Tile v2 or HERE Raster Tile v3. The default is
512ppinumber <optional>
A
ppiparameter to use when querying tiles, the default is not specified. See Base Map Tile – Optional Query Parameters for more details. For layers with raster tiles from HERE Raster Tile API v3 a value > 72 means, that tiles designed for400 ppiare used, otherwise100 ppi.lgstring <optional>
An identifier of the primary language, the default is not specified
lg2string <optional>
An identifier of the secondary language, the default is not specified
stylestring <optional>
An optional 'style' definition to use when querying map tiles, the default is not specified
opt_poisstring | boolean <optional>
A Boolean value indicating if POIs are displayed on the map (
true), valid for the "HERE Vector Tile API", "HERE Map Tile v2" and "HERE Raster Tile API v3". For layers from HERE Map Tile v2, also a mask for the POI Categories can be provided as described in the documentation for Filter POIs by Categories. By default POIs are disabled.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#storeContentengineTypeH.Map.EngineType <optional>
The engine type in use, it is used to properly configure the providers default style. Default is
H.Map.EngineType.WEBGL.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).
baseUrlH.service.Url <optional>
The base URL of the platform, the default is
https://api.here.com.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.