Stadia Maps (Stamen Tile Layer Composition)

stamen1 watercolor1 terrain-labels1 two-layers1 stadia-maps2

Example of composing layers with a Stadia Maps tile source.

Two layer groups are composed: the watercolor base layer with the terrain labels from Stamen.

import Map from 'ol/Map.js';
import StadiaMaps from 'ol/source/StadiaMaps.js';
import TileLayer from 'ol/layer/Tile.js';
import View from 'ol/View.js';
import {fromLonLat} from 'ol/proj.js';

const map = new Map({
  layers: [
    // NOTE: Layers from Stadia Maps do not require an API key for localhost development or most production
    // web deployments. See https://docs.stadiamaps.com/authentication/ for details.
    new TileLayer({
      source: new StadiaMaps({
        layer: 'stamen_watercolor',
        // apiKey: 'OPTIONAL'
    new TileLayer({
      source: new StadiaMaps({
        layer: 'stamen_terrain_labels',
        // apiKey: 'OPTIONAL'
  target: 'map',
  view: new View({
    center: fromLonLat([-122.416667, 37.783333]),
    zoom: 12,
<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <title>Stadia Maps (Stamen Tile Layer Composition)</title>
    <link rel="stylesheet" href="node_modules/ol/ol.css">
      .map {
        width: 100%;
        height: 400px;
    <div id="map" class="map"></div>

    <script type="module" src="main.js"></script>
  "name": "stamen",
  "dependencies": {
    "ol": "8.1.0"
  "devDependencies": {
    "vite": "^3.2.3"
  "scripts": {
    "start": "vite",
    "build": "vite build"