Maps API for JavaScript

China specific
Maps API for JavaScript Developer's Guide

H.service.Platform

Class Summary

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.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

configure (configurable) : {H.service.IConfigurable}

This method attempts to configure an object that implements H.service.IConfigurable.

setUseCIT (useCIT)

This method sets a flag indicating whether to use the "customer integration testing" instance of the platform.

setBaseUrl (baseUrl)

This method modifies the base URL to be used when creating service stubs.

getBaseUrl () : {H.service.Url}

This method retrieves the currently used base URL.

getTrafficIncidentsService () : {H.service.TrafficIncidentsService}

This method returns an instance of H.service.TrafficIncidentsService to query the Traffic API Traffic Incident Data

getMapTileService (opt_options) : {H.service.MapTileService}

This method retrieves an instance of H.service.MapTileService to query the Map Tile API.

getMetaInfoService (opt_params) : {H.service.metaInfo.Service}

This method returns an instance of H.service.metaInfo.Service to query the Map Tile API Metainfo Tiles

createDefaultLayers (opt_tileSize, opt_ppi, opt_lang, opt_secondaryLang, opt_style, opt_pois) : {H.service.DefaultLayers}

This method creates a pre-configured set of HERE layers for convenient use with the map.

getRoutingService (opt_options) : {H.service.RoutingService}

This method retrieves an instance of H.service.RoutingService to query the Routing API.

getGeocodingService (opt_options) : {H.service.GeocodingService}

This method retrieves an instance of H.service.GeocodingService to query the Geocoder API.

Class Description

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.

Example

var platform = new H.service.Platform({
  app_id: [your app_id],     //set your app_id
  app_code: [your app_code],   //set your app_code
  useCIT: true         //configure all services to use the 'CIT' environment
});

var geocoder = platform.getGeocodingService();
// Now you are ready to talk to the HERE Geocoder API

Constructor Details

H.service.Platform(options)

Parameters:
 
options:
{H.service.Platform.Options}
 
An object containing configuration options

Method Details

configure (configurable) : {H.service.IConfigurable}

This method attempts to configure an object that implements H.service.IConfigurable.

Parameters:
 
configurable:
{H.service.IConfigurable}
 
The object to configure
Returns:
 
{H.service.IConfigurable}
The configured object

setUseCIT (useCIT)

This method sets a flag indicating whether to use the "customer integration testing" instance of the platform.

Parameters:
 
useCIT:
{boolean}
 
A Boolean value indicating whether the CIT platform instance is to be used (true) or not (false)

setBaseUrl (baseUrl)

This method modifies the base URL to be used when creating service stubs.

Parameters:
 
baseUrl:
{H.service.Url}
 
The new base URL to use

getBaseUrl () : {H.service.Url}

This method retrieves the currently used base URL.

Returns:
 
{H.service.Url}
The current base URL

getMapTileService (opt_options) : {H.service.MapTileService}

This method retrieves an instance of H.service.MapTileService to query the Map Tile API.

Parameters:
 
opt_options:
{H.service.MapTileService.Options=} [optional]
 
An object representing the map tile service configuration options
Returns:
 
{H.service.MapTileService}
An object representing the retrieved map tile service

getMetaInfoService (opt_params) : {H.service.metaInfo.Service}

This method returns an instance of H.service.metaInfo.Service to query the Map Tile API Metainfo Tiles

Parameters:
 
opt_params:
{H.service.metaInfo.Service.Options=} [optional]
 
additional service parameters

createDefaultLayers (opt_tileSize, opt_ppi, opt_lang, opt_secondaryLang, opt_style, opt_pois) : {H.service.DefaultLayers}

This method creates a pre-configured set of HERE layers for convenient use with the map.

This method returns an object holding the three default map types

  • normal
  • terrain

Each of the map types contains the following variant layers:

  • map
  • xbase
  • base
  • traffic
  • labels

In addition, the normal map type contains the following variant layers:

  • transit
  • metaInfo
  • mapnight
  • xbasenight
  • basenight
  • trafficnight

The collection also includes:

  • incidents layer that provides an overlay that displays the current traffic incidents

Example

// Create the default layers
var layers = platform.createDefaultLayers({pois: true});

// Set the  traffic variant of the terrain map type as the base layer for the map
map.setBaseLayer(layers.terrain.traffic);
Parameters:
 
opt_tileSize:
{(H.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 (the default value is 256); if this parameter is an object, it represents configuration options for the layer and all the remaining parameters (below) should be omitted
opt_ppi:
{number=} [optional]
 
optional A 'ppi' parameter to use when querying tiles, the default is not specified
opt_lang:
{string=} [optional]
 
An optional identifier of the primary language parameter, the default is not specified
opt_secondaryLang:
{string=} [optional]
 
An optional identifier of the secondary language parameter, the default is not specified
opt_style:
{string=} [optional]
 
An optional 'style' parameter to use when querying map tiles, the default is not specified
opt_pois:
{(string | boolean)=} [optional]
 
A Boolean value indicating if POIs are displayed on the map (true) or a mask for the POI Categories as described in the Map Tile API documentation POI Categories. By default POIs are disabled.
Returns:
 
{H.service.DefaultLayers}
a set of layers ready to use

getRoutingService (opt_options) : {H.service.RoutingService}

This method retrieves an instance of H.service.RoutingService to query the Routing API.

Parameters:
 
opt_options:
{H.service.RoutingService.Options=} [optional]
 
An object containing RoutingService configuration options
Returns:
 
{H.service.RoutingService}
An instance of RoutingService

getGeocodingService (opt_options) : {H.service.GeocodingService}

This method retrieves an instance of H.service.GeocodingService to query the Geocoder API.

Parameters:
 
opt_options:
{H.service.GeocodingService.Options=} [optional]
 
An optional set of options for the new geocoding service to connect to
Returns:
 
{H.service.GeocodingService}
A new instance of GeocodingService