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 EventTag 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.createRoadEventsLayer method.

val roadEventsLayer = MapKitFactory.getInstance().createRoadEventsLayer(
    mapWindow,
    styleProvider
)

The factory method takes the MapWindow object, which you can get by calling MapView.getMapWindow, and StyleProvider interface implementation.

StyleProvider

To customize how road events are displayed, use the StyleProvider interface.

You can use a ready-made StyleProvider 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.