
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.
- Installs
- 204
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/maplibre/maplibre-agent-skills --skill maplibre-terrain-rendering- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads maplibre-terrain-rendering automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
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-relieflayer over["elevation"], notraster-coloron arasterlayer). - Runtime contour lines: contour lines straight from a
raster-demsource, 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 atpitch: 0, and raisingexaggerationwill not fix it). - Blank horizon: pitching the camera shows empty page background above the terrain (no root-level
skyobject ormap.setSky(); there is notype: "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
| Goal | What draws it |
|---|---|
| Shaded relief under a 2D map | A 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 tileset | The maplibre-contour library, feeding a vector source |
| A tilted, extruded surface you fly over | map.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.
{
"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]
{
"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]
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
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
});
terraintakes onlysourceandexaggeration(default1).[4] It is a root-level style object, set in the style or throughmap.setTerrain();map.setTerrain(null)turns it off.- Pitch is what makes it visible. At
pitch: 0an extruded surface is seen straight down and reads as flat. Setpitchon the map (ormap.easeTo({ pitch: 60 })) before concluding the terrain is broken — and raiseexaggerationonly after the camera is tilted, never as the fix for a flat-looking map. - There is no
skylayer type in MapLibre. The layer types arefill,line,symbol,circle,heatmap,fill-extrusion,raster,hillshade,color-relief, andbackground.[1] Sky is a root-levelskyobject, ormap.setSky():sky-color,horizon-color,fog-color,sky-horizon-blend,horizon-fog-blend,fog-ground-blend,atmosphere-blend.[5]sky-type,sky-atmosphere-sun, andsky-atmosphere-sun-intensityare Mapbox GL JS properties and do nothing here.fog-colorrequires 3D terrain.[5] - Fog is part of
sky. MapLibre GL JS has nosetFogmethod and no rootfogobject; haze comes fromfog-color,horizon-fog-blend, andfog-ground-blendinsky.[5] [6] 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
- maplibre-cartography — Where a hillshade layer belongs in the layer order, and palettes that survive over relief.
- maplibre-pmtiles-patterns — Serving DEM and imagery tiles from a single PMTiles file.
References
- Style Specification: layers —
hillshadeandcolor-reliefpaint properties, defaults,hillshade-methodvalues, and the complete list of layer types — https://maplibre.org/maplibre-style-spec/layers/ - Style Specification: expressions —
["elevation"], valid only incolor-relief-color— https://maplibre.org/maplibre-style-spec/expressions/ maplibre-contour—DemSource,setupMaplibre,contourProtocolUrl— https://github.com/onthegomap/maplibre-contour- Style Specification: terrain — https://maplibre.org/maplibre-style-spec/terrain/
- Style Specification: sky — https://maplibre.org/maplibre-style-spec/sky/
- GL JS
MapAPI —setTerrain,setSky,queryTerrainElevation— https://maplibre.org/maplibre-gl-js/docs/API/classes/Map/ - Examples — 3D 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.
FAQ
What does the maplibre-terrain-rendering 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.
How do I install maplibre-terrain-rendering?
Run npx skills add https://github.com/maplibre/maplibre-agent-skills --skill maplibre-terrain-rendering in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/maplibre-terrain-rendering/ (personal) or .claude/skills/maplibre-terrain-rendering/ (project).
Which AI agents can use maplibre-terrain-rendering?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is maplibre-terrain-rendering safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains maplibre-terrain-rendering?
It is published by maplibre in maplibre/maplibre-agent-skills. It has 204 recorded installs.
More from maplibre/maplibre-agent-skills
maplibre-tile-sources
maplibre/maplibre-agent-skills
Choosing what form your data needs for MapLibre GL JS — GeoJSON read straight from a file versus vector or raster tiles, the feature-count and file-size thresholds where each stops working, and how a basemap and your own data combine as separate sources. Use when deciding which source type a dataset needs, not when hosting or configuring one.
maplibre-pmtiles-patterns
maplibre/maplibre-agent-skills
Serverless vector and raster tiles with PMTiles for MapLibre GL JS — single-file format, HTTP range requests, hosting on S3/R2/GitHub Pages, generating with Planetiler or tippecanoe, and the pmtiles protocol. Use when you need no tile server or want to host tiles from static storage.
maplibre-mapbox-migration
maplibre/maplibre-agent-skills
Migrating from Mapbox GL JS to MapLibre GL JS — package and import changes, removing the access token, choosing tile sources, plugin equivalents, and what you gain or give up. Use when moving an existing Mapbox map to MapLibre.
maplibre-cartography
maplibre/maplibre-agent-skills
Open the skill to read its SKILL.md instructions.
maplibre-source-wiring
maplibre/maplibre-agent-skills
Getting a MapLibre GL JS source to actually render — TileJSON url versus hand-wired tiles templates, matching source-layer names to the tile schema, layer order and inserting below labels, promoteId and the feature ids that feature state needs, and the CORS and glyph failures behind a blank map. Use when a source is configured but nothing is drawing, or when setFeatureState does nothing.
maplibre-fonts-glyphs
maplibre/maplibre-agent-skills
Open the skill to read its SKILL.md instructions.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available