MapLibre GL JS Examples
28A WebGL-powered vector mapping library with 3D terrain and data-driven styling. All examples use MapTiler Cloud tiles.
mapMap Display & Interaction
3D Building Extrusions with MapLibre GL JSAdd 3D extruded buildings from MapTiler vector tiles using fill-extrusion layers.
chevron_right3D Terrain with MapLibre GL JSEnable 3D terrain rendering using MapTiler DEM tiles with adjustable exaggeration.
chevron_rightSatellite Basemap with MapLibre GL JSDisplay a satellite imagery basemap using the MapTiler satellite style.
chevron_rightControl Map Interactions in MapLibre GL JSEnable cooperative gestures and customize scroll zoom behavior to improve embedded map UX in MapLibre GL JS.
chevron_rightGlobe Projection with MapLibre GL JSDisplay the map as a 3D globe with atmosphere effects using MapLibre GL JS setProjection API.
chevron_rightInitialize a MapLibre GL JS MapCreate a maplibregl.Map instance with MapTiler vector tiles, navigation controls, and a marker popup.
chevron_rightSwitch Vector Styles in MapLibre GL JSChange the map style at runtime using map.setStyle() to switch between MapTiler vector tile styles.
chevron_rightStatic Map Image with MapLibre GL JSDisplay a non-interactive map image using the MapTiler Static Maps API alongside an interactive MapLibre map.
chevron_rightpin_dropMarkers, Annotations & Overlays
Custom Marker Icons with MapLibre GL JSUse custom HTML elements or symbol layers with image sprites for marker icons.
chevron_rightData-Driven Choropleth with MapLibre GL JSCreate a data-driven choropleth map using GeoJSON polygons and match expressions to color regions by value.
chevron_rightLine Layers with MapLibre GL JSDraw a route or path on the map using a GeoJSON LineString source and a line layer with custom paint properties.
chevron_rightFill Layers with MapLibre GL JSRender a filled polygon area using a GeoJSON source and a fill layer -- the MapLibre way to draw polygons on the map.
chevron_rightAdd Markers and Popups in MapLibre GL JSPlace maplibregl.Marker instances on the map with clickable Popup overlays using MapLibre GL JS.
chevron_rightPoint Clustering with MapLibre GL JSGroup nearby points into clusters using the built-in GeoJSON source clustering in MapLibre GL JS -- no plugins needed.
chevron_rightStyle Expressions with MapLibre GL JSUse MapLibre style expressions like interpolate and step to dynamically size and color features based on data properties.
chevron_rightsearchGeocoding & Search
Address Search with MapLibre GL JSSearch for places by name using the MapTiler Geocoding API and display results on a MapLibre GL JS map.
chevron_rightReverse Geocoding with MapLibre GL JSClick anywhere on a MapLibre GL JS map to get the address at that location using the MapTiler reverse geocoding API.
chevron_rightrouteRouting & Navigation
my_locationLocation & Real-Time
Geofencing with MapLibre GL JSDefine a polygon boundary in MapLibre GL JS and check whether a clicked point falls inside or outside the geofence.
chevron_rightGeolocation Control in MapLibre GL JSShow the user's current position on the map using the built-in maplibregl.GeolocateControl with tracking support.
chevron_rightFuzzy Location Circle with MapLibre GL JSShow an approximate location as a fuzzy circle polygon layer instead of an exact point for privacy protection.
chevron_rightLive GPS Tracking with MapLibre GL JSSimulate a moving marker by updating a GeoJSON source position in real time with setInterval.
chevron_rightinsightsAnalytics & Advanced
Animated Data with MapLibre GL JSAnimate a circle layer's radius paint property over time to visualize temporal data changes with requestAnimationFrame.
chevron_rightDraw Polygons with MapLibre GL JSDraw polygons on the map by clicking to place vertices and updating a GeoJSON source in real time.
chevron_rightExport Map as PNG with MapLibre GL JSCapture the current MapLibre GL JS map view as a downloadable PNG image using the WebGL canvas export API.
chevron_rightHeatmap Layer with MapLibre GL JSVisualize point density using the native heatmap layer type: no plugins needed.
chevron_rightLoad GeoJSON Source in MapLibre GL JSFetch a remote GeoJSON file and add it as a source with styled layers on a MapLibre GL JS map.
chevron_rightStore Locator with MapLibre GL JSBuild a store locator with a sidebar list and interactive map markers using MapLibre GL JS.
chevron_rightauto_awesome
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.