Maps API for JavaScript Developer's Guide

H.service.extension.platformData.Service

Class Summary

Extends: H.service.AbstractRestService

This class encapsulates the Platform Data Extension API ("PDE") in a service stub, providing methods to access its resources. Refer to the REST service documentation for the description of service parameters and response objects.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

request (entryPoint, entryPointType, params, onResult, onError) : {H.util.ICancelable}

This method sends a request to a resource with the provided name and type from the Platform Data Extension API. For available types see Constructing a Request.

createTileLayer (layerConfig, options) : {(H.map.layer.TileLayer | H.map.layer.MarkerTileLayer)}

This method creates a tile layer which can be added to the map in order to continuously fetch data for the specified layer from the Platform Data Extension API.

searchByBoundingBox (layerIds, keyAttributes, bounds, onResult, onError, opt_params) : {H.util.ICancelable}

To search for PDE data layer entries within a rectangular geographical area. See Bounding Box Search for more details.

searchByProximity (layerIds, keyAttributes, center, radius, onResult, onError, opt_params) : {H.util.ICancelable}

To search for PDE data layer entries that are within a given radius around a geographical center. See Proximity Search for more details.

searchByCorridor (layerIds, keyAttributes, corridor, radius, onResult, onError, opt_params) : {H.util.ICancelable}

To search for PDE data layer entries that are within a given radius along a polyline. See Corridor Polygon Search for more details.

configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}

This method receives configuration parameters from the platform, that can be used by the object implementing the interface. The method must not be invoked directly.

Class Description

This class encapsulates the Platform Data Extension API ("PDE") in a service stub, providing methods to access its resources. Refer to the REST service documentation for the description of service parameters and response objects.

An instance of this class can be retrieved by calling the factory method on a platform instance. H.service.Platform#getPlatformDataService.

Example

// Assumption: the platform is instantiated
platformDataService = platform.getPlatformDataService();

Constructor Details

H.service.extension.platformData.Service(opt_options)

Parameters:
 
opt_options:
{H.service.extension.platformData.Service.Options=} [optional]
 
An optional service parameters

Method Details

request (entryPoint, entryPointType, params, onResult, onError) : {H.util.ICancelable}

This method sends a request to a resource with the provided name and type from the Platform Data Extension API. For available types see Constructing a Request.

Example

// Fetching documentation 'doc/maps' resource in txt format
// Assumption: the platform is instantiated
var service = platform.getPlatformDataService();
service.request(
  H.service.extension.platformData.Service.EntryPoint.DOC_MAPS,
  H.service.extension.platformData.Service.EntryPointType.TXT, {},
  console.log, console.error);
Parameters:
 
entryPoint:
{H.service.extension.platformData.Service.EntryPoint}
 
The entry point of the Platform Data Extension API.
entryPointType:
{H.service.extension.platformData.Service.EntryPointType}
 
The type of the response for the entry point
params:
{H.service.ServiceParameters}
 
A key-value map of query parameters to use for the request.
onResult:
{function(H.service.ServiceResult)}
 
The callback which is called when result is returned
onError:
{function(string=)}
 
The callback which is called when error occurred (i.e request timeout)
Returns:
 
{H.util.ICancelable}
request handle

createTileLayer (layerConfig, options) : {(H.map.layer.TileLayer | H.map.layer.MarkerTileLayer)}

This method creates a tile layer which can be added to the map in order to continuously fetch data for the specified layer from the Platform Data Extension API.

Example

// Assumption: the platform is instantiated
pdeService = platform.getPlatformDataService();

// Create tile layer and pass function to style map objects
pdeLayer = pdeService.createTileLayer({layerId: 'PSTLCB_MP', level: 12}, {
  resultType: H.service.extension.TileProvider.ResultType.MARKER
});

// Add layer to the map
map.addLayer(pdeLayer);
Parameters:
 
layerConfig:
{H.service.extension.platformData.LayerConfig}
 
The configuration for the layer to load.
options:
{H.service.extension.TileProvider.Options}
 
The options to use when creating the tile provider.
Returns:
 
{(H.map.layer.TileLayer | H.map.layer.MarkerTileLayer)}
An object representing the tile layer

searchByBoundingBox (layerIds, keyAttributes, bounds, onResult, onError, opt_params) : {H.util.ICancelable}

To search for PDE data layer entries within a rectangular geographical area. See Bounding Box Search for more details.

Parameters:
 
layerIds:
{Array}
 
The IDs of the layers to search in.
keyAttributes:
{Array}
 
The list of the key columns, one for each layer, ordered according to the order of the layers in the layerIds argument. The key column is used to identify all entry fragments (stored on different tiles within the database) that belong to an identical entry.
bounds:
{H.geo.Rect}
 
The geographical area where to search.
onResult:
{function(Array<H.service.extension.dataView.IRow<*>>, boolean)}
 
The callback to invoke when a chunk of data is received. The following arguments are passed:
  1. The list of received entries of the PDE data layer.
  2. An indicator whether it's the last chunk.
onError:
{function(Error)}
 
The callback to invoke when an error ocurred.
opt_params:
{H.service.ServiceParameters=} [optional]
 
A key-value map of query parameters to use for the search (see PDE documentation for more details). A query parameter has a higher priority than a value provided by an according method argument.
Returns:
 
{H.util.ICancelable}
a handle that allows to cancel the search request.
Throws:
 
{H.lang.InvalidArgumentError}
 
If passed arguments are invalid

searchByProximity (layerIds, keyAttributes, center, radius, onResult, onError, opt_params) : {H.util.ICancelable}

To search for PDE data layer entries that are within a given radius around a geographical center. See Proximity Search for more details.

Parameters:
 
layerIds:
{Array<string>}
 
The IDs of the layers to search in.
keyAttributes:
{Array<string>}
 
The list of the key columns, one for each layer, ordered according to the order of the layers in the layerIds argument. The key column is used to identify all entry fragments (stored on different tiles within the database) that belong to an identical entry.
center:
{H.geo.Point}
 
The geographical point to search around.
radius:
{number}
 
The search radius in meters.
onResult:
{function(Array<H.service.extension.dataView.IRow<*>>, boolean)}
 
The callback to invoke when a chunk of data is received. The following arguments are passed:
  1. The list of received entries of the PDE data layer.
  2. An indicator whether it's the last chunk.
onError:
{function(Error)}
 
The callback to invoke when an error ocurred.
opt_params:
{H.service.ServiceParameters=} [optional]
 
A key-value map of query parameters to use for the search (see PDE documentation for more details). A query parameter has a higher priority than a value provided by an according method argument.
Returns:
 
{H.util.ICancelable}
a handle that allows to cancel the search request.
Throws:
 
{H.lang.InvalidArgumentError}
 
if the passed parameters have invalid type.

searchByCorridor (layerIds, keyAttributes, corridor, radius, onResult, onError, opt_params) : {H.util.ICancelable}

To search for PDE data layer entries that are within a given radius along a polyline. See Corridor Polygon Search for more details.

Parameters:
 
layerIds:
{Array<string>}
 
The IDs of the layers to search in.
keyAttributes:
{Array<string>}
 
The list of the key columns, one for each layer, ordered according to the order of the layers in the layerIds argument. The key column is used to identify all entry fragments (stored on different tiles within the database) that belong to an identical entry.
corridor:
{(H.geo.LineString | string)}
 
The center line of the corridor. Either defined as a H.geo.LineString or as a RouteId string that was obtained from a previous Router call. See H.service.RoutingService#calculateRoute or Routing API CalculateRouteResponseType.
radius:
{number}
 
The radius of the corridor in meters.
onResult:
{function(Array<H.service.extension.dataView.IRow<*>>, boolean)}
 
The callback to invoke when a chunk of data is received. The following arguments are passed:
  1. The list of received entries of the PDE data layer.
  2. An indicator whether it's the last chunk.
onError:
{function(Error)}
 
The callback to invoke when an error ocurred.
opt_params:
{H.service.ServiceParameters=} [optional]
 
A key-value map of query parameters to use for the search (see PDE documentation for more details). A query parameter has a higher priority than a value provided by an according method argument.
Returns:
 
{H.util.ICancelable}
a handle that allows to cancel the search request.
Throws:
 
{H.lang.InvalidArgumentError}
 
if the passed parameters have invalid type.

configure (appId, appCode, useHTTPS, useCIT, opt_baseUrl) : {H.service.IConfigurable}

This method receives configuration parameters from the platform, that can be used by the object implementing the interface. The method must not be invoked directly.

Example

// assuming that the configurable object exists and the variable name is "configurable"
var platform = new H.service.Platform({
  'app_id': [your app_id],
  'app_code': [your app_code],
})
platform.configure(configurable);
Parameters:
 
appId:
{string}
 
The application ID to identify the client against the platform (mandatory)
appCode:
{string}
 
The application code to identify the client against the platform (mandatory)
useHTTPS:
{boolean}
 
The indicator whether secure communication is used (true), the default is false
useCIT:
{boolean}
 
A value indicating whether Customer Integration Testing ("CIT") is used (true), the default is false
opt_baseUrl:
{H.service.Url=} [optional]
 
The base URL of the platform, the default is http://api.here.com. Note that if the useHTTPS flag is set to true, the URL scheme specified in the opt_baseUrl is overridden to use HTTPS.
Returns:
 
{H.service.IConfigurable}
An instance of IConfigurable reflecting the new configuration