Leaflet Example
Use a Mappinest StyleJSON basemap in Leaflet by mounting MapLibre through the maplibre-gl-leaflet bridge.
Leaflet does not render StyleJSON directly on its own. The stable vector path is to mount MapLibre inside Leaflet with @maplibre/maplibre-gl-leaflet. This example uses the light style ID from Mappinest Styles.
- For a different visual style, swap
lightwithstreets,dark, orsatellite. - Use this approach when you want vector styling behavior in Leaflet.
Leaflet
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Leaflet Map</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9.4/dist/leaflet.css" />
<link rel="stylesheet" href="https://unpkg.com/maplibre-gl@3/dist/maplibre-gl.css" />
<script src="https://unpkg.com/leaflet@1.9.4/dist/leaflet.js"></script>
<script src="https://unpkg.com/maplibre-gl@3/dist/maplibre-gl.js"></script>
<script src="https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.1.3/leaflet-maplibre-gl.js"></script>
<style>
body { margin: 0; padding: 0; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }
</style>
</head>
<body>
<div id="map"></div>
<script>
const map = L.map('map').setView([45, 15], 5);
L.maplibreGL({
style: 'https://api.mappinest.com/styles/light/style.json?key=YOUR_KEY',
interactive: true
}).addTo(map);
</script>
</body>
</html>Last updated: March 13, 2026