Svelte Maplibre

API / Sources

RasterTileSource

Add a raster tile source to the map. Give the tiles with tiles (an array of tile URLs) or with url.

Place a RasterLayer inside this component's children and it uses this source automatically. The children render only after the source is added.

If url contains pmtiles://, the component registers the PMTiles protocol for you. When tiles changes, the component updates the tiles of the existing source. Most other props are applied only when the source is created.

import { RasterTileSource } from 'svelte-maplibre';

Examples

Props

  • id string

    Default: getId('raster-source')

  • tiles string[]

    An array one or more tile source URLs pointing to the tiles. Either tiles or url must be provided.

  • tileSize number
  • url string

    A single URL pointing to a PMTiles archive. Either tiles or url must be provided.

  • bounds [number, number, number, number]
  • minzoom number
  • maxzoom number
  • volatile boolean
  • children Snippet

Source: src/lib/RasterTileSource.svelte