Maps API for JavaScript Developer's Guide

H.service.extension.customLocation.TileProvider

Class Summary

Extends: H.service.extension.TileProvider

This class represents a provider for continuous fetching of data by tiles from a data layer of the Custom Location Extension API.

[ For full details, see the Class Details ]

Events Summary

Table 1. Events
Events

error : {H.util.Event}

The Event is fired, when runtime error occurs

Class Description

This class represents a provider for continuous fetching of data by tiles from a data layer of the Custom Location Extension API.

Caused by asynchronous behavior of this provider there might be cases when an "error" event is fired, for example when no data layer with the specified ID exists.

Each map object provided by this class has data associated with it which is of type H.service.extension.dataView.IRow and can be retrieved by calling H.map.Object#getData method.

Example

// Assumption: the platform is instantiated
var cleService = platform.getCustomLocationService();

var provider = new H.service.extension.customLocation.TileProvider(cleService, {
  // Assumption: the "MyMarkerLayer" exists on the server
  layerId: 'MyMarkerLayer',
  // Execution context of the "rowFilter"
  rowFilterContext: {
    ids: [1, 2]
  },
  // Filter rows
  rowFilter: function(row, layerId) {
    // "this" within this function scope is the "rowFilterContext" object.
    // So we filter out all rows except those which value of the "COL_A" column is 1 or 2
    return this.ids.indexOf(row.getCell('COL_A')) !== -1;
  },
  // All data columns except those mentioned will be filtered out
  columns: ['COL_A', 'COL_B']
  }, {
  resultType: H.service.extension.TileProvider.ResultType.MARKER
});

map.addLayer(new H.map.layer.MarkerTileLayer(provider));

Constructor Details

H.service.extension.customLocation.TileProvider(service, layerConfig, options)

Parameters:
 
service:
{H.service.extension.customLocation.Service}
 
An object representing the CLE service
layerConfig:
{H.service.extension.customLocation.LayerConfig}
 
The configuration options of the data layer
options:
{H.service.extension.TileProvider.Options}
 
An object containing configuration options. By default 'min' option is 12.

Event Details

error: {H.util.Event}

The Event is fired, when runtime error occurs