Skip to content

3D Terrain Is Not Supported in OpenLayers

OpenLayers does not support 3D terrain or map pitch.

Why it does not work

OpenLayers renders in 2D. It has no camera pitch and no terrain mesh, so there is nothing to drape elevation data over. This is a limit of the library, not of the tiles or your key: the same raster-dem source works in MapLibre GL JS and Mapbox GL JS unchanged.

You can still use the elevation data with OpenLayers, just not as 3D relief. The tiles are Terrarium-encoded PNGs, so you can decode a pixel to a height value yourself, and the Elevation API returns heights directly without any decoding.

Next steps

If the elevation matters but the 3D does not, the Elevation API gives you heights as numbers in any library, OpenLayers included, which covers profile charts, climb totals and anything you want to label. Contours or a hillshade image overlay are the other way to show relief on a flat map.

If the 3D is the requirement, this is the moment to change library rather than work around it. MapLibre GL JS renders the same source as relief with no change to the data, and its other APIs map closely enough that porting a basic map is an afternoon.