Traffic
The Traffic layer displays an overlay that is color coded to indicate the flow of traffic on the roads. Traffic is only visible at zoom levels greater than 9. The higher the zoom level the more zoomed in you are on the map.
Set the visibility of the traffic layer.
myMap.on('load', function() {
myMap.setTrafficVisibility(true);
});
Get the visibility of the traffic layer.
const trafficVisible = myMap.isTrafficVisible();
Toggle the visibility of the traffic layer.
myMap.toggleTrafficVisibility();
Traffic layer color codes
Open |
|
Light Traffic |
|
Heavy Traffic |
|
Road Closed |
|