I'm trying to load some additional tile layers on my map but I can't quite figure it out. The ones that I currently have I only have thanks to someone that provided a tutorial but didn't say what the other tile options were. Can someone help me with this?
var mapboxUrl = 'https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}'; var accessToken = 'mySuperSecretToken'; var grayscale = L.tileLayer(mapboxUrl, {id: 'mapbox.light', attribution: '', maxZoom: 20, accessToken: accessToken}), streets = L.tileLayer(mapboxUrl, {id: 'mapbox.streets', attribution: '', maxZoom: 20, accessToken: accessToken});
I cannot seem to figure out how to get any additional layers or even use the new streets version that I got an email about today.
What are Mapbox vector tiles? Vector tiles are a lightweight data format for storing geospatial vector data, such as points, lines, and polygons. Mapbox vector tiles are designed to visualize a large amount of data on a map in a scalable and cost effective way.
Mapbox pricing is described here - mapbox.com/pricing - the free tier applies to public and free-to-access apps. For private or pay-for apps you don't get a free tier. Note that your quota usage might not be updated in real time.
Leaflet is an open-source JavaScript library used for web mapping. The Leaflet library forms the basis of Mapbox.
Leaflet is "just" a map API. It doesn't provide data/maps itself. Mapbox is a service to design and publish maps, where the end-result is a bunch of generated map-tiles stored in the cloud (and some json files).
I actually finally found the answer.
The URL string needed to be updated to
https://api.mapbox.com/styles/v1/mapbox/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}
The available styles ({id}) are
Full list of Mapbox classic map IDs, ie for Leaflet, are at https://www.mapbox.com/api-documentation/#maps.
At the time of writing the IDs are:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With