How can I use a custom created mapbox style along with leaflet
with current Mapbox version:
- after you created your own style, click "Share..." at right top menu
- You get popup, select Develop "Third Party" and in dropdown "CARTO"
- copy "Integration URL". This is the link you need for Leaflet.js to set value for the 'tileLayer' object
I successfully added a mapbox style to leaflet
On this URL https://www.mapbox.com/studio/styles/ select your style. Ill use a default style for this example (i think this one is available to all) https://www.mapbox.com/studio/styles/mapbox/streets-v10/share/
Then on this page select the leaflet tab
Copy the Url and use like so in your js file
var map = L.map('map');
L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/streets-v10/tiles/256/{z}/{x}/{y}?access_token=pk.eyJ1IjoibWFza290YSIsImEiOiJjaXp0bmI3M3EwMDBvMndzMHJudnlsMDllIn0.jV7rTNmfiqjx57usCu54rQ', {
maxZoom: 18,
attribution: 'Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, ' +
'<a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="http://mapbox.com">Mapbox</a>',
}).addTo(map);
It's really simple.
The URL to use your map as a tile map:
https://api.mapbox.com/styles/v1/YOUR_USERNAME/YOUR_STYLE_ID/tiles/256/{z}/{x}/{y}?access_token=YOUR_ACCESS_TOKEN
If you want to copy/import a style to your studio account:
https://www.mapbox.com/studio/styles/add-style/THE_USERNAME/THE_STYLE_ID/