MapTiler SDK Examples
29An all-in-one SDK with built-in geocoding, terrain, and cloud tiles. All examples use MapTiler Cloud tiles.
Map display & interaction
3D Building Extrusions with MapTiler SDK Extrude 3D buildings on a MapTiler SDK map with a fill-extrusion layer that reads render_height from the building source layer of the vector tiles.
3D Terrain with MapTiler SDK Turn on 3D terrain in MapTiler SDK with the terrain and terrainExaggeration options of maptilersdk.Map, then tilt the camera with pitch to see the relief.
Satellite Basemap with MapTiler SDK Show satellite imagery as the basemap of a MapTiler SDK map by setting style to maptilersdk.MapStyle.SATELLITE in the maptilersdk.Map constructor.
Disputed Borders View with MapTiler SDK Filter disputed boundary lines in MapTiler SDK by calling map.setFilter() on boundary layers with the claimed_by property for a chosen country's view.
Configure Map Gestures with MapTiler SDK Require Ctrl+scroll to zoom an embedded MapTiler SDK map by setting cooperativeGestures to true in the maptilersdk.Map constructor.
Globe Projection with MapTiler SDK Render the Earth as a 3D globe in MapTiler SDK by setting projection to 'globe' in the maptilersdk.Map options, here over satellite imagery.
Initialize a Map with MapTiler SDK Initialize a MapTiler SDK map with maptilersdk.config.apiKey and new maptilersdk.Map, then pin a maptilersdk.Marker with a Popup on Paris.
Set Map Language with MapTiler SDK Localize map labels at runtime in MapTiler SDK by calling map.setLanguage() with a language code such as 'en', 'de', or 'local' to swap the label text.
Switch MapStyle with MapTiler SDK Switch between MapTiler styles at runtime by passing maptilersdk.MapStyle constants such as STREETS, SATELLITE, or TOPO to map.setStyle() in MapTiler SDK.
Static Map Image with MapTiler SDK Embed a static map image from the MapTiler Static Maps API through an img src URL and place it above an interactive MapTiler SDK map.
Markers, annotations & overlays
Custom Marker Icons with MapTiler SDK Use a custom SVG or HTML element as a MapTiler SDK marker icon by passing the element option to maptilersdk.Marker and attaching a Popup.
Data-Driven Choropleth with MapTiler SDK Color countries by population in MapTiler SDK with a fill layer whose fill-color paint property uses an interpolate expression on pop_est.
Line Layers with MapTiler SDK Add a route to a MapTiler SDK map with map.addSource() for a GeoJSON LineString and map.addLayer() for a line layer styled by line-color and line-width.
Fill Layers with MapTiler SDK Fill a polygon area on a MapTiler SDK map by adding a GeoJSON source with map.addSource() and styling it with a fill layer plus a line layer outline.
Add Markers and Popups with MapTiler SDK Place markers on a MapTiler SDK map with maptilersdk.Marker and attach an HTML info window to each one via setPopup() and maptilersdk.Popup.
Point Clustering with MapTiler SDK Cluster dense points in MapTiler SDK with the cluster option on a GeoJSON source, then draw circle layers and a symbol layer for point_count labels.
Style Expressions with MapTiler SDK Style earthquake circles in MapTiler SDK with interpolate expressions on the mag property that drive the circle-radius and circle-color paint properties.
Geocoding & search
Address Search with MapTiler SDK Geocode a place name with the MapTiler Geocoding API via fetch() and fly a MapTiler SDK map to the result with map.flyTo() and a maptilersdk.Marker.
Reverse Geocoding with MapTiler SDK Reverse geocode a clicked point with the MapTiler Geocoding API and show the returned place_name in a maptilersdk.Popup on a MapTiler SDK map.
Location & real-time
Geofencing with MapTiler SDK Test whether a clicked point lies inside a geofence polygon drawn as fill and line layers in MapTiler SDK, and report the result in a maptilersdk.Popup.
Geolocation Control with MapTiler SDK Track the user's position on a MapTiler SDK map with maptilersdk.GeolocateControl, using trackUserLocation and showUserHeading for live updates.
Fuzzy Location Circle with MapTiler SDK Hide an exact location in MapTiler SDK by rendering an approximate circle polygon as a GeoJSON source with a fill layer and a dashed line layer.
Live GPS Tracking with MapTiler SDK Move a maptilersdk.Marker along a path with setLngLat() on a timer and keep it centered with map.panTo() to simulate live GPS tracking in MapTiler SDK.
Analytics & advanced
Animated Data with MapTiler SDK Animate earthquake points over time in MapTiler SDK by calling map.setFilter() on a circle layer from a requestAnimationFrame loop.
Drawing Tools with MapTiler SDK Collect polygon vertices from map clicks in MapTiler SDK and redraw them with setData() on a GeoJSON source rendered as fill, line, and circle layers.
Export Map as PNG with MapTiler SDK Export a MapTiler SDK map view to PNG by enabling preserveDrawingBuffer and calling toDataURL() on the canvas returned by map.getCanvas().
Heatmap Layer with MapTiler SDK Render earthquake density as a MapTiler SDK heatmap layer, weighting points by magnitude with heatmap-weight and coloring them with heatmap-color.
Load GeoJSON with MapTiler SDK Load a remote GeoJSON file into MapTiler SDK with map.addSource(), style it as a circle layer, and open a maptilersdk.Popup when a feature is clicked.
Store Locator with MapTiler SDK Link a sidebar store list to maptilersdk.Marker pins in MapTiler SDK, so clicking an entry calls map.flyTo() and opens its Popup with togglePopup().
Build maps using MapTiler SDK with AI
Install the MapTiler SDK skill in your IDE and let AI write the code for you.
All examples use MapTiler maps and require a free API key.