Leaflet Examples
22A lightweight, mobile-friendly 2D mapping library with a large plugin ecosystem. All examples use MapTiler Cloud tiles.
mapMap Display & Interaction
Satellite Basemap with LeafletDisplay MapTiler satellite imagery with an optional labels overlay toggle using Leaflet tile layer controls.
chevron_rightControl Map Gestures in LeafletConfigure Leaflet map interactions including scroll wheel zoom, drag panning, double-click zoom, and touch gestures using L.map options.
chevron_rightInitialize a Leaflet Map with MapTiler TilesCreate and embed an interactive Leaflet map with MapTiler raster tiles, pan/zoom controls, and a marker in just a few lines of code.
chevron_rightSwitch Tile Layers in LeafletSwitch between MapTiler raster tile styles at runtime using Leaflet's built-in L.control.layers switcher.
chevron_rightStatic Map Image with LeafletDisplay a non-interactive map image using the MapTiler Static Maps API: perfect for thumbnails, emails, and social previews.
chevron_rightpin_dropMarkers, Annotations & Overlays
Custom Marker Icons with LeafletReplace the default marker pin with custom PNG or SVG icons using L.icon() and L.divIcon().
chevron_rightChoropleth Map with LeafletCreate a data-driven choropleth map that colors regions by value using inline GeoJSON and Leaflet.
chevron_rightDraw Polylines on a Leaflet MapDraw a styled L.polyline connecting multiple coordinates on a Leaflet map to visualize routes or paths.
chevron_rightDraw Polygons on a Leaflet MapDraw filled L.polygon areas on a Leaflet map with custom stroke and fill styles.
chevron_rightAdd Markers and Popups to a Leaflet MapPlace L.marker pins on a Leaflet map with interactive popups containing custom HTML content.
chevron_rightMarker Clustering with LeafletGroup nearby markers into expandable clusters using the Leaflet.markercluster plugin for better performance with large datasets.
chevron_rightsearchGeocoding & Search
routeRouting & Navigation
my_locationLocation & Real-Time
Geofencing with LeafletDefine a polygon boundary and check whether a point is inside or outside the geofence.
chevron_rightShow User Location on a Leaflet MapDisplay the user's current GPS position on a Leaflet map using the browser Geolocation API with an accuracy circle.
chevron_rightFuzzy Location with LeafletDisplay an approximate location as a fuzzy L.circle area instead of an exact marker pin for privacy protection.
chevron_rightinsightsAnalytics & Advanced
Drawing Tools with LeafletAdd interactive drawing and editing tools to a Leaflet map using the Leaflet.draw plugin.
chevron_rightExport Leaflet Map as PNGCapture the current Leaflet map view as a downloadable PNG image using the html2canvas library.
chevron_rightHeatmap Visualization with LeafletVisualize point density as a heatmap on a Leaflet map using the leaflet.heat plugin.
chevron_rightLoad GeoJSON Data in LeafletFetch a GeoJSON file and render its features on a Leaflet map with custom styling and interactive popups.
chevron_rightStore Locator with LeafletBuild a store locator with a sidebar list and interactive map pins using Leaflet.
chevron_rightauto_awesome
Build maps using Leaflet with AI
Install the Leaflet skill in your IDE and let AI write the code for you.
All examples use MapTiler maps and require a free API key.