I am a new user and I can't seem to get the tiles on the map.
var mymap = L.map('mapid').setView([51.512, -0.104], 1);
L.tileLayer('https://api.mapbox.com/styles/v1/mapbox/{mapbox.mapbox-streets-v8}/tiles/{z}/{x}/{y}?access_token={accessToken}', {
attribution: 'Map data © <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
maxZoom: 18,
id: 'mapbox.mapbox-streets-v8',
accessToken: 'accessToken.here'
}).addTo(mymap);
var source = new EventSource('/topic/twitterdata2');
source.addEventListener('message', function(e){
obj = JSON.parse(e.data);
console.log(obj);
lat = obj.place.bounding_box.coordinates[0][0][1];
long = obj.place.bounding_box.coordinates[0][0][0];
username = obj.user.name;
tweet = obj.text;
marker = L.marker([lat,long],).addTo(mymap).bindPopup('Username: <strong>' + username + '</strong><br>Tweet: <strong>' + tweet + '</strong>');
}, false);
{mapbox.mapbox-streets-v8}
you must specify just{id}
in layer url. Alsoid
value is wrong, it should be onlystreets-v8
.