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
stringDefault:
getId('raster-source') - tiles
string[]An array one or more tile source URLs pointing to the tiles. Either
tilesorurlmust be provided. - tileSize
number - url
stringA single URL pointing to a PMTiles archive. Either
tilesorurlmust be provided. - bounds
[number, number, number, number] - attribution
string - minzoom
number - maxzoom
number - volatile
boolean - children
Snippet
Source: src/lib/RasterTileSource.svelte