MapSnippets logo MapSnippets logo

MapLibre GL JS Examples

28

A WebGL-powered vector mapping library with 3D terrain and data-driven styling. All examples use MapTiler Cloud tiles.

Map display & interaction

3D extruded buildings in Prague's old town rendered with MapLibre GL JS.
3D Building Extrusions with MapLibre GL JS Extrude MapTiler building footprints in MapLibre GL JS with a fill-extrusion layer whose fill-extrusion-height reads each feature's render_height.
3D terrain of the Alps near Zinal, Switzerland, rendered with MapLibre GL JS.
3D Terrain with MapLibre GL JS Render 3D terrain in MapLibre GL JS from a MapTiler raster-dem source with map.setTerrain() and an exaggeration factor, plus fog via setSky().
Satellite aerial imagery of a city center shown as a MapLibre GL JS basemap.
Satellite Basemap with MapLibre GL JS Show MapTiler satellite imagery as the basemap of a MapLibre GL JS map by loading the satellite style into maplibregl.Map, tilted with pitch.
Berlin map configured with cooperative scroll and gesture handling in MapLibre GL JS.
Control Map Interactions in MapLibre GL JS Stop an embedded MapLibre GL JS map from hijacking page scroll by setting cooperativeGestures in the maplibregl.Map constructor options.
3D globe view of Earth centered on Europe and Africa, rendered with MapLibre GL JS.
Globe Projection with MapLibre GL JS Turn a MapLibre GL JS map into a 3D globe by calling map.setProjection() with type globe after style.load, shown on the MapTiler satellite style.
MapLibre GL JS map centered on Paris with a marker, loaded with MapTiler vector tiles.
Initialize a MapLibre GL JS Map Initialize a MapLibre GL JS map with maplibregl.Map and the MapTiler streets-v4 style, then add a NavigationControl and a Marker with a Popup.
Paris map showing the active MapTiler vector style name for runtime style switching.
Switch Vector Styles in MapLibre GL JS Switch MapTiler styles at runtime in MapLibre GL JS by calling map.setStyle() with a new style URL such as streets-v4, outdoor-v4, or dataviz-dark.
Non-interactive static map image of Prague generated with the MapTiler Static Maps API.
Static Map Image with MapLibre GL JS Embed a PNG from the MapTiler Static Maps API, built from center, zoom, and size in the URL, above an interactive MapLibre GL JS map of the same view.

Markers, annotations & overlays

Geocoding & search

Routing & navigation

Location & real-time

Analytics & advanced

Build maps using MapLibre GL JS with AI

Install the MapLibre GL JS skill in your IDE and let AI write the code for you.

All examples use MapTiler maps and require a free API key.