Road event layer
Road events are information about traffic situations. They include accidents, restrictions, road work, and speed cameras. You can find a complete list of available road events in the RoadEventsEventTag enum.
The road event layer can display road events along the route as icons. To render road events, add a map layer where they'll be displayed.
In NaviKit SDK, the road event layer is the RoadEventsLayer class.
Create
To create a road event layer, use the mapkit.createRouteRoadEventsLayer method.
final roadEventsLayer = mapkit.createRouteRoadEventsLayer(
mapWindow,
roadEventsLayerStyleProvider
);
The factory method takes the MapWindow object, which you can get by calling MappableMap(), and RoadEventsLayerStyleProvider interface implementation.
RoadEventsLayerStyleProvider
To customize how road events are displayed, use the RoadEventsLayerStyleProvider interface.
You can use a ready-made RoadEventsLayerStyleProvider implementation that provides road event icon styles and resources in the signature style of API Maps. To learn how to enable the dependency, follow the link.
Road event display
Use RoadEventsLayer.setRoadEventVisibleOnRoute to set event visibility on the route for the current route in guidance mode and in alternate overview mode.