I created this custom mapbox style to use in leaflet OR as a base map in tableau and it doesn’t work in either.
Here is my style’s preview link: https://api.mapbox.com/styles/v1/jbuell2024/clzlwunn0003701r83gbo30zp.html?title=view&access_token=pk.eyJ1IjoiamJ1ZWxsMjAyNCIsImEiOiJjbHpsdXJoMnMwNnRyMnZwd3hseXBkZnJyIn0.LhvNTpWqA389pQTriiNB7A&zoomwheel=true&fresh=true#5.92/36.758/-118.037
Here is the style URL: mapbox://styles/jbuell2024/clzlwunn0003701r83gbo30zp
Here is the basic leaflet code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Leaflet Map with Mapbox Layer</title>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<style>
#map {
height: 100vh;
width: 100vw;
}
</style>
</head>
<body>
<div id="map"></div>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
// Initialize the map centered on a specific location
var map = L.map('map').setView([37, -119.0187], 6);
// Add Mapbox style layer to the map
L.tileLayer('https://api.mapbox.com/styles/v1/jbuell2024/clzlwunn0003701r83gbo30zp/tiles/256/{z}/{x}/{y}@2x?access_token=pk.eyJ1IjoiamJ1ZWxsMjAyNCIsImEiOiJjbHpsdXJoMnMwNnRyMnZwd3hseXBkZnJyIn0.LhvNTpWqA389pQTriiNB7A', {
attribution: 'Map data © <a href="https://www.mapbox.com/about/maps/">Mapbox</a> contributors',
minZoom: 0,
maxZoom: 22
}).addTo(map);
</script>
</body>
</html>
Where am I going wrong?
I have tried testing my access token to ensure that is not the issue via replacing my style ID with a generic mapbox ID and the generic mapbox style loads correctly, so it’s not an issue of my access token. When I test the leaflet code, all there is is a grey screen.