Maplibre Terrain Rendering logo

Maplibre Terrain Rendering

Organization
maplibre
maplibre-terrain-rendering

Drawing elevation in MapLibre GL JS once a raster-dem source works — hillshade and `hillshade-method`, the `color-relief` layer and the `["elevation"]` expression, runtime contours with `maplibre-contour`, and 3D terrain with its camera and sky. Use when relief looks harsh, flat, or absent, or when the layer type or property for an elevation effect is unclear.

Overview

Publishermaplibre
Repositorymaplibre-agent-skills
Skill namemaplibre-terrain-rendering
Stars
148
Forks
10
Bundled files
Instructions only
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by maplibre on GitHub. Read the source before you install it.

Installation

Install the Maplibre Terrain Rendering AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/maplibre/maplibre-agent-skills.git /tmp/maplibre-agent-skills
mkdir -p .claude/skills
cp -r /tmp/maplibre-agent-skills/skills/maplibre-terrain-rendering .claude/skills/maplibre-terrain-rendering
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Maplibre Terrain Rendering in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Maplibre Terrain Rendering on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Maplibre Terrain Rendering is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

MapLibre Terrain Rendering

A raster-dem source is elevation, not a picture. Four different things draw it, each with its own layer type or API, and most of the wrong answers here are Mapbox GL JS properties that MapLibre never had.

When to Use This Skill

These are symptoms as you would observe them, before you know the cause:

  • Harsh hillshade contrast: black-and-white ridges, blown-out slopes, chalky valleys — or several hillshade layers stacked to soften them (one layer with hillshade-method: "multidirectional").
  • Dynamic elevation coloring: the map needs coloring by height, client-side, with no pre-rendered tiles (a color-relief layer over ["elevation"], not raster-color on a raster layer).
  • Runtime contour lines: contour lines straight from a raster-dem source, with no pre-generated contour tileset (maplibre-contour, not a hand-rolled marching-squares pipeline).
  • Flat 3D terrain: map.setTerrain() is on and nothing extrudes (the camera is at pitch: 0, and raising exaggeration will not fix it).
  • Blank horizon: pitching the camera shows empty page background above the terrain (no root-level sky object or map.setSky(); there is no type: "sky" layer in MapLibre).
  • Silent property failures: a hillshade, sky, or terrain-coloring property does nothing and raises no error (a Mapbox GL JS property MapLibre never had).
  • Terrain lag or frame drops: stutter when panning or tilting with terrain on (stacked hillshade passes, dense draped layers).

Not this skill. Elevation values that are wrong, spiky, or inverted, choosing an elevation tileset, encoding, and generating DEM tiles — the style specification's raster-dem source page, https://maplibre.org/maplibre-style-spec/sources/#raster-dem. Where hillshade sits among the other layers of a style — maplibre-cartography.

Which one you want

GoalWhat draws it
Shaded relief under a 2D mapA hillshade layer. No setTerrain needed — the two are independent
Color by height (hypsometric tint)A color-relief layer (GL JS 5.6)
Contour lines, without pre-generating a tilesetThe maplibre-contour library, feeding a vector source
A tilted, extruded surface you fly overmap.setTerrain() plus camera pitch

All four read the same raster-dem source; one source can serve all of them.

Hillshade, and the harshness fix that is not stacking

Every hillshade-* property is a paint property.[1] The defaults that matter: hillshade-exaggeration 0.5, hillshade-illumination-direction 335, hillshade-illumination-anchor viewport (the light is fixed to the top of the screen, so it does not turn with the map's bearing unless you set map), hillshade-shadow-color #000000, hillshade-highlight-color #FFFFFF.

Harsh output usually comes from the shading method, not the colors. hillshade-method (GL JS 5.5) takes standard (the default), basic, combined, igor, and multidirectional.[1] multidirectional lights the surface from several independent directions in one pass and igor minimizes the effect on the map features drawn beneath it; both soften terrain on a single layer.

json
{
  "id": "hillshade",
  "type": "hillshade",
  "source": "terrain-dem",
  "paint": {
    "hillshade-method": "multidirectional",
    "hillshade-exaggeration": 0.4,
    "hillshade-illumination-anchor": "map",
    "hillshade-shadow-color": "rgba(30,40,80,0.45)",
    "hillshade-highlight-color": "rgba(255,240,200,0.4)"
  }
}

Do not stack several hillshade layers at different illumination directions. It was the only way to get multi-directional shading before 5.5; since then it is one paint property against N extra draw passes over the same DEM. Pure black shadows and pure white highlights are the other harshness lever: give both an alpha, and use warm highlights with cool shadows over imagery.

Color-relief: coloring by height

color-relief (GL JS 5.6) colors a raster-dem source directly, client-side; there is no pre-rendering step and no raster layer involved. Its paint properties are color-relief-color, color-relief-opacity (default 1), and, from GL JS 5.20, resampling.[1] The ramp is an interpolate expression over ["elevation"], which returns meters above the DEM's vertical datum and is only valid inside color-relief-color.[2]

json
{
  "id": "hypsometric",
  "type": "color-relief",
  "source": "terrain-dem",
  "paint": {
    "color-relief-color": [
      "interpolate",
      ["linear"],
      ["elevation"],
      0,
      "#2c7bb6",
      500,
      "#abd9e9",
      1500,
      "#ffffbf",
      2500,
      "#fdae61",
      4000,
      "#ffffff"
    ],
    "color-relief-opacity": 0.8
  }
}

MapLibre has no raster-color, raster-value, or raster-color-mix; those belong to another renderer and will be dropped as unknown properties. A raster layer pointed at a DEM shows packed RGB, not a tint.

Contours at runtime

maplibre-contour derives vector contour tiles in a Web Worker from the same DEM tiles and serves them through a registered protocol — no contour tileset to build.[3]

javascript
import mlcontour from 'maplibre-contour';

const demSource = new mlcontour.DemSource({
  url: 'https://tiles.mapterhorn.com/{z}/{x}/{y}.webp',
  encoding: 'terrarium',
  maxzoom: 12,
  worker: true
});
demSource.setupMaplibre(maplibregl);

map.addSource('contours', {
  type: 'vector',
  tiles: [
    demSource.contourProtocolUrl({
      thresholds: { 11: [200, 1000], 12: [100, 500], 14: [50, 200] },
      elevationKey: 'ele',
      levelKey: 'level',
      contourLayer: 'contours'
    })
  ],
  maxzoom: 15
});

map.addLayer({
  id: 'contour-lines',
  type: 'line',
  source: 'contours',
  'source-layer': 'contours',
  paint: { 'line-color': 'rgba(0,0,0,0.4)', 'line-width': ['match', ['get', 'level'], 1, 1.2, 0.6] }
});

thresholds maps zoom to [minor, major] intervals in meters; level is 1 on major contours, which is what the line width and any label layer key on.[3] The encoding here must match the DEM exactly as it does on the style source.

3D terrain, the camera, and the sky

javascript
map.addSource('terrain-dem', { type: 'raster-dem', url: 'https://tiles.mapterhorn.com/tilejson.json' });
map.setTerrain({ source: 'terrain-dem', exaggeration: 1 });
map.setSky({
  'sky-color': '#199EF3',
  'sky-horizon-blend': 0.5,
  'horizon-color': '#ffffff',
  'horizon-fog-blend': 0.5,
  'fog-color': '#0000ff',
  'fog-ground-blend': 0.5
});
  • terrain takes only source and exaggeration (default 1).[4] It is a root-level style object, set in the style or through map.setTerrain(); map.setTerrain(null) turns it off.
  • Pitch is what makes it visible. At pitch: 0 an extruded surface is seen straight down and reads as flat. Set pitch on the map (or map.easeTo({ pitch: 60 })) before concluding the terrain is broken — and raise exaggeration only after the camera is tilted, never as the fix for a flat-looking map.
  • There is no sky layer type in MapLibre. The layer types are fill, line, symbol, circle, heatmap, fill-extrusion, raster, hillshade, color-relief, and background.[1] Sky is a root-level sky object, or map.setSky(): sky-color, horizon-color, fog-color, sky-horizon-blend, horizon-fog-blend, fog-ground-blend, atmosphere-blend.[5] sky-type, sky-atmosphere-sun, and sky-atmosphere-sun-intensity are Mapbox GL JS properties and do nothing here. fog-color requires 3D terrain.[5]
  • map.queryTerrainElevation(lngLat) returns the elevation under a location once terrain is on.[6]

Cost. Terrain decodes DEM tiles, builds a mesh, and re-draws every layer draped over it, so it is the most expensive thing on this page — noticeably so at high zoom and pitch on low-end devices. Keep the terrain stack small: one shared raster-dem source, one or two elevation layers, and only the overlays you need.

Related Skills

References

  1. Style Specification: layershillshade and color-relief paint properties, defaults, hillshade-method values, and the complete list of layer types — https://maplibre.org/maplibre-style-spec/layers/
  2. Style Specification: expressions["elevation"], valid only in color-relief-colorhttps://maplibre.org/maplibre-style-spec/expressions/
  3. maplibre-contourDemSource, setupMaplibre, contourProtocolUrlhttps://github.com/onthegomap/maplibre-contour
  4. Style Specification: terrainhttps://maplibre.org/maplibre-style-spec/terrain/
  5. Style Specification: skyhttps://maplibre.org/maplibre-style-spec/sky/
  6. GL JS Map APIsetTerrain, setSky, queryTerrainElevationhttps://maplibre.org/maplibre-gl-js/docs/API/classes/Map/
  7. Examples3D terrain, sky, fog, terrain, color relief, contour lines, multidirectional hillshade

This skill is a snapshot. Where a primary source contradicts it — the References above, MapLibre's current documentation, or what MapLibre does when you run it — that source wins. Follow it, then report the disagreement, citing the source and your MapLibre version: editing your installed copy helps no one else and is overwritten on the next update.

Frequently asked questions

What does the Maplibre Terrain Rendering AI skill do?

Drawing elevation in MapLibre GL JS once a raster-dem source works — hillshade and `hillshade-method`, the `color-relief` layer and the `["elevation"]` expression, runtime contours with `maplibre-contour`, and 3D terrain with its camera and sky. Use when relief looks harsh, flat, or absent, or when the layer type or property for an elevation effect is unclear.

Why use Maplibre Terrain Rendering on TypingMind?

Because you install it once and use it with any model. Maplibre Terrain Rendering is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Maplibre Terrain Rendering in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/maplibre/maplibre-agent-skills/tree/main/skills/maplibre-terrain-rendering. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Maplibre Terrain Rendering?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Maplibre Terrain Rendering?

As many as you like. As long as a model supports skills, you can use Maplibre Terrain Rendering with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Maplibre Terrain Rendering AI skill free?

It is published on GitHub by maplibre. Check the repository for licensing terms. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇