The traffic object for drawing/removing incidents and flows.
Draws traffic flows and incidents on the map. If the zoom level is 9 or lower, only a clickable traffic market icon will appear. Clicking on the traffic market icon will zoom in on the market and display the traffic flow and incidents.
var map = new mqgl.Map('map', 'KEY', {
center: [-118.2437, 34.0522],
});
map.load( () => {
map.traffic.draw()
});
None
A Promise
Removes all traffic items from the map.
var map = new mqgl.Map('map', 'KEY', {
center: [-118.2437, 34.0522],
});
map.load( () => {
map.traffic.draw();
setTimeout( () => {
map.traffic.remove();
}, 2000);
});
None
A Promise
Determines if traffic is drawn on the map.
var map = new mqgl.Map('map', 'KEY', {
center: [-118.2437, 34.0522],
});
map.load( () => {
map.traffic.draw().then( () => {
console.log(map.traffic.isOn())
});
});
None
Boolean