Skip to content

Add a raster tile source

Replicates the MapLibre example Add a raster tile source: OpenStreetMap raster tiles above the vector basemap.

add-a-raster-tile-source.yaml
# yaml-language-server: $schema=https://docs.maplibre-yaml.org/schema/latest/map.schema.json
# Gallery twin of https://maplibre.org/maplibre-gl-js/docs/examples/add-a-raster-tile-source/
type: map
id: add-a-raster-tile-source
config:
center: [2.3488, 48.8534]
zoom: 11
mapStyle: "https://demotiles.maplibre.org/style.json"
layers:
- id: osm-raster
type: raster
source:
type: raster
tiles:
- "https://tile.openstreetmap.org/{z}/{x}/{y}.png"
tileSize: 256
attribution: "© OpenStreetMap contributors"
  • A raster source is tiles: + tileSize; attribution rides the source into the attribution control.