The code above comes from an example at:

Display a 3D terrain map | JavaScript maps SDK | MapLibre GL JS | MapTiler
This tutorial demonstrates how to create a 3D terrain map and display it on a web page using MapTiler Cloud.

Snowology