L.ALKMaps.Layer.TrafficIncidents layer allows you to display current traffic incidents on your map. Traffic incidents are loaded asynchronously.
By default, traffic incident icons are viewable at zoom level 8 and higher. Multiple incidents may be clustered together up until zoom level 14 and higher, at which point only individual incidents are shown. Cluster icons have 3 default sizes: for less than 10 items, icon size is 12 pixels by 12 pixels; less than 100, icon size is 16 pixels by 16 pixels, anything else, icon size is 24 pixels by 24 pixels.
When you hover over a single incident icon, a tool-tip with a brief description of the incident shows on the right. Clicking a single incident icon opens a pop-up message with a more detailed description. Clicking a cluster icon brings forward the individual incident icons in the cluster.
You can also customize the behavior of the layer with:
The display language of your choice, by supplying a language option. Options include:
en- English (Default),
A progress indicator, using the
Custom Cluster icons, using the
Custom traffic incident pop-ups and tool-tips, using the
Sample HTML on adding scripts and CSS references
<head> <title>Traffic Incidents - Leaflet</title> <link rel="stylesheet" href="https://firstname.lastname@example.org/dist/leaflet.css"> <script src="https://email@example.com/dist/leaflet.js"></script> <link rel="stylesheet" href="https://firstname.lastname@example.org/dist/MarkerCluster.css"> <!-- Default.css is not needed. Comment out in case you need it. --> <!-- <link rel="stylesheet" href="https://email@example.com/dist/MarkerCluster.Default.css">--> <script src="https://firstname.lastname@example.org/dist/leaflet.markercluster-src.js"></script> <script src="https://maps.alk.com/api/1.2/alkmaps.js"></script> </head>