Maps API for JavaScript Developer's Guide

H.service.xyz.Provider

Class Summary

Extends: H.map.provider.RemoteTileProvider

This class represents a provider for fetching data from HERE XYZ API.

[ For full details, see the Class Details ]

Method Summary

Table 1. Methods
Methods

getStyle () : {H.map.Style}

To obtain the style used for rendering the provider data.

setStyle (style)

Sets the style to be used for rendering the provider data. The style MUST have a space ID as a layer name in order to match data correctly, e.g.:

Class Description

This class represents a provider for fetching data from HERE XYZ API.

Example

// Assumption: the platform is instantiated
var service = platform.getXYZService({
    token: 'authentication_token_goes_here'
  }),
  provider = new H.service.xyz.Provider(service, 'space_id_goes_here');
map.addLayer(new H.map.layer.TileLayer(provider));

Constructor Details

H.service.xyz.Provider(service, spaceId, opt_options)

Parameters:
 
service:
{H.service.xyz.Service}
 
The XYZ service instance.
spaceId:
{string}
 
Space ID that defines a given "space" resource.
opt_options:
{H.service.xyz.Provider.Options=} [optional]
 
An object containing configuration for the provider.
Throws:
 
{H.lang.InvalidArgumentError}
 
If at least one of required params is not supplied.

Method Details

getStyle () : {H.map.Style}

To obtain the style used for rendering the provider data.

Returns:
 
{H.map.Style}

setStyle (style)

Sets the style to be used for rendering the provider data. The style MUST have a space ID as a layer name in order to match data correctly, e.g.:

Example

provider.setStyle(new H.map.Style(`
  sources:
  xyz:
    type: MVT
  layers:
  # "R4QDHvd1" identifies a space that contains geometries of Chicago buildings
  R4QDHvd1:
    data:
    source: xyz
    points:
    filter:
      $geometry: point
    draw:
      points:
      ...
    polygons:
    ...
    lines:
    ...
`));
Parameters:
 
style:
{H.map.Style}