Mapbox powered tracking of South Coast Bus System in Oxnard, CA.
var pubnub = new PubNub({
publishKey: 'demo',
subscribeKey: 'demo'
});
eon.map({
id: 'map',
mbId: 'YOUR_MAPBOX_ID',
mbToken: 'YOUR_MAPBOX_TOKEN',
channel: 'south-coast-bus-data',
rotate: true,
history: true,
marker: function (latlng, data) {
var marker = new L.RotatedMarker(latlng, {
icon: L.icon({
iconUrl: 'https://i.imgur.com/2fmFQfN.png',
iconSize: [9, 32]
})
});
marker.bindPopup('Route ' + data.routeTag.toUpperCase());
return marker;
}
});
var pubnub = new PubNub({
publishKey: 'demo',
subscribeKey: 'demo'
});
setInterval(function(){
pubnub.publish({
channel: 'south-coast-bus-data',
message:
[
{"latlng":[31,-99]},
{"latlng":[32,-100]},
{"latlng":[33,-101]},
{"latlng":[35,-102]}
]
});
}, 1000);