Data Providers
Providers define interfaces for layers to access data. The Geovisualization JavaScript API includes several types of providers:
-
H.datalens.QueryTileProvider
defines the source of the data from a tiled Geovisualization query. -
H.datalens.QueryProvider
defines the source of the data from a non-tiled Geovisualization query. -
H.datalens.SpatialTileProvider
defines the source of geometries from a tiled Geovisualization query. H.datalens.RawDataProvider
defines the source of the data from a local or remote data file in GeoJSON or CSV format.-
H.datalens.Provider
defines the source of the data from a JSON object.
Normally, a tiled query using H.datalens.QueryTileProvider
is the most efficient approach, as it fetches and processes only the data needed for the user's current viewport.
To instantiate QueryTileProvider
you must provide a configured service
and tiled query credentials, such as:
- a Geovisualization query ID
- names of URI parameters that control the x/y/z of the tiled query. Geovisualization JavaScript API and HERE Maps API use the OpenStreetMap XYZ numbering scheme. When defining the Geovisualization query, dynamic parameters that control tiling can be arbitrarily named. The names of these parameters must be specified to fetch tiles.
- other dynamic parameters supported by the Geovisualization query
var provider = new H.datalens.QueryTileProvider(
service,
{
queryId: TILED_QUERY,
tileParamNames: {x: 'x', y: 'y', z: 'z'},
queryParams: {...}
}
);
Normally, you update the visualization by changing the query's dynamic parameters:
provider.setQueryParams({
someFilter: filterValue
});
provider.reload();
The provider.reload
call triggers the update
event which leads to a map redraw.