Geovisualization Developer's Guide

Service

Class Summary

Implements: H.service.IConfigurable

Provides connectivity with the Data Lens REST API.

[ For full details, see the Constructor Details ]

Class Description

HERE Maps API and Data Lens JavaScript API can be used to visualize data from different network sources. For each network source type, a service class is required. The service also stores API connection credentials. The service instance must be configured with a H.service.Platform instance.
var service = platform.configure(new H.datalens.Service());

Constructor Details

H.datalens.Service (options)

Parameters:
 
options :
{ H.datalens.Service.Options }
Overrides the configuration from the H.service.Platform instance

Method Details

request (method, endpoint, params, body, onResult, onError) : { Promise.<{Object}> }

This method makes an HTTP request to the Data Lens REST API. It makes any CRUD request (GET, PUT, POST, DELETE). This method can be used when implementing a custom provider or implementing data management. Otherwise existing providers are used to get data from the Data Lens REST API.

Parameters:
 
method :
{ string }
Any HTTP method (GET, PUT, POST, etc.)
endpoint :
{ string }
The REST API endpoint
params :
{ object } [optional]
URL parameters
body :
{ object } [optional]
The payload of the request
onResult :
{ function( object ) } [optional]
Callback called on a successful request with response data
onError :
{ function( Error ) } [optional]
Callback called on an unsuccessful request with the Error object
Returns:
 
:
{ Promise.<{Object}> }
Response Promise

fetchQueryData (queryId, params, onResult, onError) : { Promise.<{Object}> }

This method fetches query data for a given query ID. This method can be used when implementing a custom provider. Otherwise existing providers are used to get data from the Data Lens REST API.

Parameters:
 
queryId :
{ string }
The ID of the Data Lens REST API query
params :
{ object } [optional]
Query dynamic parameters
onResult :
{ function( object ) } [optional]
Callback called on a successful request with response data
onError :
{ function( Error ) } [optional]
Callback called on an unsuccessful request with the Error object
Returns:
 
:
{ Promise.<{Object}> }
Response Promise

fetchQueryStats (queryId, statsQuery, onResult, onError) : { Promise.<{Object}> }

This method fetches statistical data for the Data Lens query (eg minimum and maximum values for the query metric). It can be used to define visualization boundaries, scales and legends.

Parameters:
 
queryId :
{ string }
The ID of the Data Lens REST API query
statsQuery :
{ object }
A JSON object which defines a statistics query for the Data Lens query
onResult :
{ function( object ) } [optional]
Callback called on a successful request with response data
onError :
{ function( Error ) } [optional]
Callback called on an unsuccessful request with the Error object
Returns:
 
:
{ Promise.<{Object}> }
Response Promise

fetchLayer (layerName, params, onResult, onError) : { Promise.<{Object}> }

This method fetches a layer of geometries (eg buildings or administrative boundaries).

Parameters:
 
layerName :
{ string }
The name of the layer
params :
{ object } [optional]
URL parameters (eg bounding box)
onResult :
{ function( object ) } [optional]
Callback called on a successful request with response data
onError :
{ function( Error ) } [optional]
Callback called on an unsuccessful request with the Error object
Returns:
 
:
{ Promise.<{Object}> }
Response Promise

fetchLayerTile (layerName, x, y, z, params, onResult, onError) : { Promise.<{Unit8Array}> }

This method fetches vector tile data from the layer.

Parameters:
 
layerName :
{ string }
[description]
x :
{ H.datalens.QueryTileProvider.X }
Tile columns
y :
{ H.datalens.QueryTileProvider.Y }
Tile row
z :
{ H.datalens.QueryTileProvider.Zoom }
zoom level
params :
{ object } [optional]
URL parameters (eg bounding box)
onResult :
{ function( object ) } [optional]
Callback called on a successful request with response data
onError :
{ function( Error ) } [optional]
Callback called on an unsuccessful request with the Error object
Returns:
 
:
{ Promise.<{Unit8Array}> }
Typed array with tile data

setTokens (accessToken, refreshToken)

Sets the access and refresh tokens used to authenticate all requests against the Data Lens REST API. Use this method to implement custom authentication to the Data Lens REST API.
service.request('POST', 'sign_in', {}, credentials).then(function(res) {
  service.setTokens(res.access_token, res.refresh_token);
});
Parameters:
 
accessToken :
{ string }
The token used to authenticate all requests
refreshToken :
{ string }
The token used to fetch a new access token after the previous access token has expired. When refreshToken is provided, Service will automatically update the expired accessToken .

configure (appId, appCode, useHTTPS, useCIT, baseUrl) : { H.datalens.Service }

This method implements H.service.IConfigurable interface. It is called by the H.service.Platform instance.

Parameters:
 
appId :
{ string }
The appId
appCode :
{ string }
The appCode
useHTTPS :
{ boolean }
A flag to use HTTPS or not
useCIT :
{ boolean }
A flag to use the staging server (CIT) or not
baseUrl :
{ H.service.Url } [optional]
The base URL for all requests to the Data Lens REST API
Returns:
 
:
{ H.datalens.Service }

You cannot use this account to purchase a commercial plan on Developer Portal, as it is already associated to plans with different payment methods.

To purchase a commercial plan on Developer Portal, please register for or sign in with a different HERE Account.

Something took longer than expected.

The project should be available soon under your projects page.

Sorry, our services are not available in this region.

Something seems to have gone wrong. Please try again later.

We've detected that your account is set to Australian Dollars (AUD).
Unfortunately, we do not offer checkouts in AUD anymore.
You can continue using your current plan as normal, but to subscribe to one of our new plans,
please register for a new HERE account or contact us for billing questions on selfservesupport@here.com.