Geovisualization Developer's Guide

Object Layer

H.datalens.ObjectLayer presents data points as markers or spatial map objects with data-driven styles and client-side clustering. The source of the data can be either tiled or non-tiled. Styles for map objects can be parameterized with data rows and zoom level. ObjectLayer creates data-driven icons for markers, such as donuts or bars.

To render a simple marker for each row of Geovisualization query data you must define provider and the rowToMapObject callback:

var layer = new H.datalens.ObjectLayer(
    rowToMapObject: function(row) {
      return new
        {lat: row.latitude, lng: row.longitude}

And you must add the layer to the map:


Several options define the rendering of data on the map with ObjectLayer:

  • dataToRows defines how the input data is split by rows. You can specify this callback to define client-side aggregation and filtering. By default it represents each row as an object where property names correspond to data column names.
  • clustering.rowToDataPoint callback defines H.clustering.DataPoint from rows. When provided, rows returned from dataToRows go to the rowToDataPoint callback to be transformed to data points. Then, the data points are clustered to produce clusters and noise points. Clusters and noise points are presented as map objects with the rowToMapObject callback and can be styled with the rowToStyle callback.
  • clustering.options defines clustering options as a function of the zoom level.
  • rowToMapObject defines how each row, cluster or noise point is presented on the map (for example: with a marker or a polygon).
  • rowToStyle defines map object style and icon according to the data row and zoom level (data-driven styling).

Non-clustering data flow:

Figure 1. Data flow without clustering

Clustering data flow:

Figure 2. Data flow with clustering