Geovisualization Developer's Guide

H.datalens. ObjectLayer

Class Summary


Presents data as points or spatial map objects with data-driven styles and client-side clustering.

[ For full details, see the Class Details ]

Class Description

Applicable for drawing interactive map objects like markers, polygons, circles and other instances of Source of data can be either tiled or not tiled. Styles for objects can be parametrized with data rows and zoom level. Allows to create data-driven icons for markers like donuts or bars. Also enables clustering and data domains for visualizing up to 100k points or more.
var layer = new H.datalens.ObjectLayer(
    rowToMapObject: function(row) {
      return new, row.lon);

Constructor Details

H.datalens.ObjectLayer (provider, options)

provider : { | H.datalens.Provider | H.datalens.QueryProvider | H.datalens.QueryTileProvider }
Data source (tiled or not)
options : { H.datalens.ObjectLayer.Options }
Defines data processing, clustering and data-driven styling

Property Details

static defaultDataToRows : { function( H.datalens.Service.Data ) : Array.< H.datalens.ObjectLayer.Row > }

Default value for dataToRows callback option. It represents each row as an object where property names correspond to data column names.
var layer = new H.datalens.ObjectLayer(
     dataToRows: function(data) {
       return H.datalens.ObjectLayer.defaultDataToRows(
       ).filter(function() {

Method Details

static createIcon (svg, options) : { }

A factory method for data-driven icons. The method allows you to build an icon from SVG markup or JsonML object. Provides caching of icons with the same markup.
var metricScale = d3.linearScale();
var layer = new H.datalens.ObjectLayer(
   rowToStyle: function (row) {
     return {},
     icon: H.datalens.ObjectLayer.createIcon(
         {viewBox: [-8, -8, 8, 8]},
         ['circle', {r: metricScale(row.metric), cx: 0, cy: 0}],
       {size: 16}
svg : { string | array }
SVG presented as markup or JsonML Array
options : { } [optional]
Icon options (eg size and anchor). Note that the default anchor is in the middle.
options.size : { H.math.ISize | number } [optional]
When the icon is a square, you can define the size as a number in pixels
: { }
Icon which can be used for marker or cluster

static getIconCache () : { H.util.Cache }

Returns cache of icons created with the createIcon method. Can be used to clean the icon cache.

: { H.util.Cache }
Icon cache

redraw ()

Force re-rendering of the layer. In the case where the callbacks passed to the layer options are not pure functions, you can call this method to force re-rendering.

updateObjectStyle (object, state)

Recalculates the style and applies it to the map object based on the new StyleState

object : { }
Map object
state : { H.datalens.ObjectLayer.StyleState }
New state

static createReusableMarker (id, args) : { }

A factory method for creating reusable markers.

id : { number | string }
a unique id for the marker
args : { object }
arguments passed to the constructor
: { }
- a reusable marker