class

RasterTileLayer

extends LayerBase

implements ITileLayer

XYZ/TMS raster tile layer. Loads map tiles from a URL template with {z}/{x}/{y} placeholders. Used for basemaps (OpenStreetMap, Mapbox, etc.).

Constructor

new RasterTileLayer(options: RasterTileLayerOptions)
Parameter Type Description
options RasterTileLayerOptions required Tile layer configuration

RasterTileLayerOptions

Field Type Description
id string optional Layer ID
urlTemplate string required URL with {z}, {x}, {y}, {s} placeholders
tms boolean optional Use TMS y-flip convention Default: false
subdomains string[] optional Subdomain rotation for {s} Default: []
minZoom number optional Minimum zoom level Default: 0
maxZoom number optional Maximum zoom level Default: 22
attribution string optional Attribution text
visible boolean optional Initial visibility Default: true
opacity number optional Layer opacity (0-1) Default: 1
filters { brightness?, contrast?, saturate? } optional Visual filters

Properties

Name Type Access Description
type 'raster-tile' readonly Layer type discriminant
urlTemplate string readonly URL template
tms boolean readonly TMS mode flag
subdomains readonly string[] readonly Subdomain list
minZoom number readonly Min zoom
maxZoom number readonly Max zoom
attribution string | undefined readonly Attribution text

Methods

getTileUrl()

getTileUrl(z: number, x: number, y: number): string

Generate a tile URL for given coordinates.

Returns string

isZoomValid()

isZoomValid(z: number): boolean

Check if zoom level is within min/max bounds.

Returns boolean

Example

const osm = new RasterTileLayer({
  id: 'osm',
  urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
  minZoom: 0,
  maxZoom: 19,
  attribution: '© OpenStreetMap contributors',
});
view.map.add(osm);