API / Layers
RasterLayer
Add a MapLibre raster layer to the map. It shows raster tiles, such as from a RasterTileSource.
This is a thin wrapper around Layer with type set to raster. Place it inside a source component such as GeoJSON, or set the source prop.
import { RasterLayer } from 'svelte-maplibre'; Generic parameters: FEATURE extends Feature = Feature
Examples
Props
- layout
RasterLayerSpecification["layout"]
Inherited from CommonLayerProps
- id
anyDefault:
getId('raster-layer') - source
stringSet the source for this layer. This can be omitted when the Layer is created in the slot of a source component.
- sourceLayer
stringWhen setting up a layer for a vector tile source, the source layer to which this layer corresponds.
- beforeId
stringDraw this layer under another layer. This is only evaluated when the component is created.
- beforeLayerType
string | ((layer: maplibregl.LayerSpecification) => boolean)Draw this layer all layers of this type. This is only evaluated when the component is created.
- filter
maplibregl.ExpressionSpecification - minzoom
number - maxzoom
number - hoverCursor
stringSet the cursor style to this value when the mouse is over the layer.
- manageHoverState
booleanEnable to use hoverStateFilter or filter on
hover-state. Features must have anidproperty for this to work. - hovered
FEATURE & MapGeoJSONFeature - eventsIfTopMost
boolean - interactive
booleanHandle mouse events on this layer.
- children
Snippet - onclick
(e: LayerClickInfo<FEATURE>) => void - ondblclick
(e: LayerClickInfo<FEATURE>) => void - onmouseenter
(e: LayerClickInfo<FEATURE>) => void - onmousemove
(e: LayerClickInfo<FEATURE>) => void - onmouseleave
(e: Pick<LayerClickInfo<FEATURE>, 'map' | 'layer' | 'source'>) => void
Source: src/lib/RasterLayer.svelte