TileLayer.js

TileLayer()


constructor
Inherits from BaseLayer

The class responsible for adding tiles from a tile server on the map.

Options:
  • tileSize(Number)The width or height of the tiles in pixels (default: 256)
  • errorTileAttemptsThreshold(Number)The number of times to try to load a tile before firing tile-error (default: 1)
  • reuseTiles(Boolean)If true, reuses the cached tiles (default: true)
  • opacity(Number)The opacity of the layer with values from 0 to 1 (default: 1)
  • autoLoadTiles(Boolean)If true, reloads the tiles when update method is called (default: true)
  • tile404(String)The path to the 404 error tile (default: '../assets/404-tile.png')
Events:
  • tile-loadA tile was loaded
  • tiles-loadedAll tiles were loaded
  • tile-errorA tile could not be loaded
Parameter Type Description
url String The URL to the tile server containing z, x, y coordinates
options Object The tile options

setOpacity()


method

Sets a new layer opacity

Parameter Type Description
opacity Number The new opacity of the layer. Values can be from 0 to 1