This class encapsulates the HERE Interactive Map Layer Data API in a service stub, providing methods to access its resources.
It's not allowed to call the constructor directly (an IllegalOperationError is thrown).
Instead an instance of this Service can be retrieved by calling the factory method
H.service.Platform#getIMLService on a platform instance.
| Name | Type | Description |
|---|---|---|
options |
H.service.iml.Service.Options |
Configuration options for the service. |
Throws:
-
If instantiated directly.
Example
// Assumption: the platform is instantiated
const imlService = platform.getIMLService();
imlService.getStatistics('catalog_hrn_goes_here', 'layer_id_goes_here', console.log, console.error);
Extends
Members
-
The property name to use when specifying options for this service within the
H.service.Platform.Options#servicesConfig.
Methods
-
addEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method adds a listener for a specific event.
Note that to prevent potential memory leaks, you must either call
removeEventListenerordisposeon the given object when you no longer need it.Name Type Description typestring The name of the event
handlerfunction An event handler function
opt_captureboolean optional trueindicates that the method should listen in the capture phase (bubble otherwise)opt_scopeObject optional An object defining the scope for the handler function
-
addOnDisposeCallback (callback, opt_scope) inherited
-
This method adds a callback which is triggered when the
EventTargetobject is being disposed.Name Type Description callbackfunction The callback function.
opt_scopeObject optional An optional scope for the callback function
-
deleteFeature (featureId, catalogHrn, layerId, onResult, onError)H.util.ICancelable
-
To delete an individual feature from the layer. Creates a
DELETErequest that returns an empty response with204(No Content) status code in case of success.Name Type Description featureIdstring A feature identifier.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with an empty response.
onErrorfunction(Error) A callback function to be called in case of failed request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
deleteFeatures (featureIds, catalogHrn, layerId, onResult, onError)H.util.ICancelable
-
To delete features from the layer.
Name Type Description featureIdsArray.<string> An array of feature identifiers.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
- See:
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
dispatchEvent (evt) inherited
-
This method dispatches an event on the
EventTargetobject.Name Type Description evtH.util.Event | string An object representing the event or a string with the event name
-
dispose () inherited
-
This method removes listeners from the given object. Classes that extend
EventTargetmay need to override this method in order to remove references to DOM Elements and additional listeners. -
getFeatureById (featureId, catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To retrieve an individual feature in the layer, by feature ID.
Name Type Description featureIdstring A feature identifier.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with an object containing individual feature.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
getFeaturesByBoundingBox (params, catalogHrn, layerId, onResult, onError)H.util.ICancelable
-
To retrieve a list of features in the layer, by bounding box.
Name Type Description paramsH.service.ServiceParameters An object with either
bboxor a full set ofnorth+east+south+westvalues specifying a bounding box, together with other (optional) service parameters.catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
getFeaturesByGeometryAndRadius (params, geojsonObject, catalogHrn, layerId, onResult, onError)H.util.ICancelable
-
To retrieve a list of features in the layer, by geometry and radius. Creates a
POSTrequest with a given GeoJSON geometry as its body.Name Type Description paramsH.service.ServiceParameters An object with
radiusand other (optional) service parameters.geojsonObjectObject A GeoJSON Geometry object (e.g.
Point,Polygon, ...) to calculate an origin point.catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. Example
const polygon = new H.map.Polygon(...); imlService.getFeaturesByGeometryAndRadius( {radius: 1000}, polygon.toGeoJSON().geometry, 'catalog_hrn_goes_here', 'layer_id_goes_here', console.log, console.error, ); -
-
getFeaturesById (featureIds, catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To retrieve a list of features in the layer, by their IDs.
Name Type Description featureIdsArray.<string> An array of feature identifiers.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
getFeaturesByPointAndRadius (params, catalogHrn, layerId, onResult, onError)H.util.ICancelable
-
To retrieve a list of features in the layer, by center point and radius. A center point could be either specified directly or by referencing a feature (which could be from another layer).
Name Type Description paramsH.service.ServiceParameters An object with
radiusand eitherlat+lngorrefCatalogHrn+refLayerId+refFeatureIdcombination, together with other (optional) service parameters.catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. Example
imlService.getFeaturesByPointAndRadius( {lat: 38.90192, lng: -76.97605, radius: 1000}, 'catalog_hrn_goes_here', 'layer_id_goes_here', console.log, console.error, ); -
-
getFeaturesByTile (x, y, z, catalogHrn, layerId, onResult, onError, opt_params, opt_geojsonFormat)H.util.ICancelable
-
To request layer data by tile coordinates.
Name Type Description xnumber Tile column number.
ynumber Tile row number.
znumber Zoom level.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction((ArrayBuffer|H.service.ServiceResult)) A callback function to be called with either MVT or GeoJSON tile data, depending on the
opt_geojsonFormatargument (MVT by default).onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request. The
clipparameter is set totrueby default.opt_geojsonFormatboolean optional Defines whether to request features in GeoJSON (
true) or MVT (false) format. Default value isfalse.Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
getStatistics (catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To retrieve a statistical information about the layer.
Name Type Description catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with an object containing statistical information about the layer.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
getUrl ()H.service.Url inherited
-
This method returns the configured service URL.
Returns:
Type Description H.service.Url -
iterateFeatures (catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To retrieve all features in the layer, in a paginated manner.
Name Type Description catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
patchFeature (featureId, geojsonObject, catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To update specific fields of an individual feature in the layer, preserving untouched fields. Creates a
PATCHrequest with a given GeoJSON payload as its body.Name Type Description featureIdstring A feature identifier.
geojsonObjectObject A GeoJSON
Featureobject to patch.catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
postFeatures (geojsonObject, catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To create or update features in the layer. Creates a
POSTrequest with a given GeoJSON payload as its body. Keeps previously existing features in the layer.Name Type Description geojsonObjectObject A GeoJSON object containing features to store.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
putFeature (featureId, geojsonObject, catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To create or replace an individual feature in the layers. Creates a
PUTrequest with a given GeoJSON payload as its body.Name Type Description featureIdstring A feature identifier.
geojsonObjectObject A GeoJSON
Featureobject to store.catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
putFeatures (geojsonObject, catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To create or replace features in the layer. Creates a
PUTrequest with a given GeoJSON payload as its body. Deletes all previously existing features in the layer.Name Type Description geojsonObjectObject A GeoJSON object containing features to store.
catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
-
removeEventListener (type, handler, opt_capture, opt_scope) inherited
-
This method removes a previously added listener from the
EventTargetinstance.Name Type Description typestring The name of the event
handlerfunction A previously added event handler
opt_captureboolean optional trueindicates that the method should listen in the capture phase (bubble otherwise)opt_scopeObject optional An object defining the scope for the handler function
-
searchFeatures (catalogHrn, layerId, onResult, onError, opt_params)H.util.ICancelable
-
To search for features in the layer.
Name Type Description catalogHrnstring A HERE Resource Name (HRN) for the catalog.
layerIdstring An identifier for the layer in the catalog.
onResultfunction(H.service.ServiceResult) A callback function to be called with a FeatureCollection object.
onErrorfunction(Error) A callback function to be called in case of failed request.
opt_paramsH.service.ServiceParameters optional Optional service parameters to be added to the request.
Throws:
-
If at least one of required arguments is not supplied or has a wrong type.
Returns:
Type Description H.util.ICancelable A handle that allows to cancel the request. -
Type Definitions
-
This type encapsulates configuration options for an instance of an IML service.
Properties:
Name Type Argument Description baseUrlH.service.Url <optional>
The base URL of the service. If supplied, it overrides all defaults (either coming from platform or service internals) including authentication params.
subDomainstring <optional>
The subdomain of the IML service relative to the base URL.
pathstring <optional>
The path to use within the service URL.
headersObject <optional>
A map of HTTP headers to be sent with each request made by the service.
getTokenfunction A callback function to return an access token. When provided, this function is called by each transport method of the service in order to supply
Authorization: Bearer {token}request header.