Meta Layers

Allows you to create additional layers of meta information and add them to the map.

DG.Meta.layer

Inherits from DG.Layer.

Creation

Factory Usage Description
DG.Meta.layer( <String> source, <DG.Meta.layer options> options? ) DG.Meta.layer(…) Creates additional layer with meta-information. Takes the source URL as a parameter with which the tiles of an additional layer are available.

Options

Option Type Default Description
tileSize Number 256 The tile size (width and height in pixels, it is assumed that the tile is square).
minZoom Number 0 The minimum zoom level.
maxZoom Number 18 The maximum zoom level.
zoomOffset Number 0 Value which will shift the zoom level in the tile's address.
eventBubbling String 'transparent'||'layer' The way in which meta-layer handles events. Accepts values layer or transparent (default):
  • transparent — meta-layer receives all of the events and carry them to the map
  • layer — meta-layer receives all of the events and stops them after processing

Events

You can subscribe to the following events using these methods.

Event Data Description
mouseover MetaEvent Called when you hover the mouse over the additional layer object.
mouseout MetaEvent Called when the mouse cursor leaves the bounds of an additional layer object.
mousemove MetaEvent Called when the mouse cursor moves over an additional layer object.
click MetaEvent Called when the mouse click in the additional layer.
dblclick MetaEvent Called when the mouse double-click in the additional layer.
mousedown MetaEvent Called when the mouse button is pressed while the cursor is over the additional layer.
contextmenu MetaEvent Called when you click the right mouse button in the additional layer.

Methods

Method Returns Description
getOrigin() Object Returns origin-instance of additional layer.

DG.Meta.origin

Works with the meta data of a layer, inherits from DG.Class.

Creation

Factory Usage Description
DG.Meta.origin( <String> source, <DG.Meta.layer options> options? ) DG.Meta.origin(…) Creates an instance for work with the meta layer data. Takes the source URL as a parameter with which the tiles of an additional layer are available.

Options

Option Type Default Description
subdomains String или String[] '0123' Tile service subdomains. Can be sent as one string (where each letter — is a subdomain name) or as an array of strings.
dataFilter Function null Optional parameter, which takes a function to filter or convert the meta data received from the server.

Methods

Method Returns Description
getTileData( <Object> coord) Object Returns the metadata of the meta layer for the specified tile.
setTileData( <String>/<Object> coord, <Object> data) this Assigns data for the tile with the coord key.
flush() this Clear cached data for all tiles.
setURL( <String> url, <Boolean> flush?) this Sets the url used to get the meta data. If the parameter flush=true, the cached data will be cleared.
getTileKey( <Object> coord) String Returns the key of the tile as a string.