Class: Platform
- Last UpdatedMay 21, 2025
- 12 minute read
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:
Returns:
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.HARP
engineType. See:H.Map.Options
.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 -
getCustomLocationService (opt_options)H.service.extension.customLocation.Service Deprecated : since 3.1.30.12
-
To obtain a new instance of
H.service.extension.customLocation.Service
to query the HERE Fleet Telematics API endpoints related to creation, modification and retrieval of the custom data layers.Name Type Description opt_options
H.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.Service
to query the custom route endpoint of the HERE Fleet Telematics API.Name Type Description opt_options
H.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.GeocodingService
to query the Geocoder API.Name Type Description opt_options
H.service.GeocodingService.Options optional Configuration options for geocoding service
Returns:
Type Description H.service.GeocodingService The created GeocodingService
instance -
getGeofencingService (opt_options, opt_version)H.service.GeofencingService | H.service.extension.geofencing.Service
-
To create a new instance of either
H.service.extension.geofencing.Service
orH.service.GeofencingService
to query the selected Geofencing API. For compatibility reasons the class defaults to the deprecated HERE Fleet Telematics API, new applications should provide the optionalopt_version
parameter to get access to the new HERE Geofencing API v8Name Type Description opt_options
H.service.Options optional Configuration options for Geofencing service
opt_version
number optional Indicates the optional version of the Geofencing API to use, allowed values are
8
for the HERE Geofencing API v8 orundefined
for 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.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. -
getMapTileService (opt_options)H.service.MapTileService
-
To create a new instance of
H.service.MapTileService
to query the Map Tile API.Name Type Description opt_options
H.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.Service
to query the Map Tile API Metainfo TilesName Type Description opt_options
H.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.Service
to query data from the HERE Optimized Map Visualization (OMV) endpoint.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 -
getPlacesService (opt_options)H.service.PlacesService Deprecated : since 3.1.30.12
-
To create a new instance of
H.service.PlacesService
to query the Places API.Name Type Description opt_options
H.service.omv.Service.Options optional Configuration options for places service
Returns:
Type Description H.service.PlacesService The created PlacesService
instance -
getPlatformDataService (opt_options)H.service.extension.platformData.Service Deprecated : since 3.1.30.12
-
This method returns an instance of
H.service.extension.platformData.Service
to query the HERE Fleet Telematics API.Name Type Description opt_options
H.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.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, opt_version)H.service.RoutingService | H.service.RoutingService8
-
To create a new instance of
H.service.RoutingService
to query the selected Routing API. For compatibility reasons the class defaults to the deprecated Routing API v7, new applications should provide the optionalopt_version
parameter to get access to the new Routing API v8Name Type Description opt_options
H.service.Options optional Configuration options for routing service
opt_version
number optional Indicates the version of the Routing API to use, allowed values are
7
for the Routing API v7 and8
for 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.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, opt_version)H.service.traffic.Service | H.service.traffic.Service7
-
This method returns either an instance of
H.service.traffic.Service
orH.service.traffic.Service7
to 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_version
parameter to get access to the new Traffic API v7.Name Type Description opt_options
H.service.traffic.Service.Options | H.service.Options optional Configuration options for traffic service
opt_version
number optional Indicates the version of the Traffic API to use, allowed values are
6
for the Traffic API v6 and7
for 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.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, opt_version)H.venues.Service | H.venues.Service2
-
To create a new instance of
H.venues.Service2
to 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 options
H.venues.Service.Options optional Configuration options for the Venues service
opt_version
number.<(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 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 v8Name 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. -
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
-
This type encapsulates options used to create default layers.
Properties:
-
This type encapsulates the configuration (initialization) options for an instance of
Platform
.Properties: