---
metadata:
  - name: generator
    content: Diplodoc Platform v5.64.2
alternate:
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/traffic.provider.Actual.md
  - https://yandex.com.tr/dev/jsapi-v2-1/doc/ru/v2-1/ref/reference/traffic.provider.Actual.md
  - href: https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/traffic.provider.Actual.md
    type: text/markdown
    title: Markdown version
  - href: https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt?revision=r21950234
    rel: describedby
---
> **Documentation Index:** Fetch the complete configuration index at https://yandex.com.tr/dev/jsapi-v2-1/doc/en/llms.txt?revision=r21950234

# traffic.provider.Actual

Extends [ITrafficProvider](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ITrafficProvider.md).

Provider of real-time traffic data. Accessible in the provider storage by the key 'traffic#actual'.

[Constructor](#constructor-summary) | [Fields](#properties-summary) | [Events](#events-summary) | [Methods](#methods-summary)

## Constructor {#constructor-summary}

```javascript
traffic.provider.Actual([options[, state]])
```

Creates a provider of real-time traffic data.

**Parameters:**

#|
|| **Parameter** | **Default value** | **Description**  ||
|| [`options`](#param-options) | — | Type: Object

Provider options. Options for provider layers are set via the options for the global collection of layers, [Map.layers](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md#layers). 
- Options for the image layer [Layer](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Layer.md) are defined with the 'trafficImage' prefix.
- Options for the hotspot layer [hotspot.Layer](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/hotspot.Layer.md) are defined with the 'trafficJam' prefix.
- Options for the infopoint layer are defined with the 'trafficInfo' prefix. The infopoint layer is an instance of the [hotspot.Layer](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/hotspot.Layer.md) class. ||
|| [`options.autoUpdate`](#param-options.autoUpdate) | true | Type: Boolean

Flag that enables automatically updating traffic data. Automatic updates occur only when the "mousemove" event occurs every 4 minutes on the map. If this event does not occur, traffic stops being updated until there is a new event. ||
|| [`state`](#param-state) | — | Type: Object

Provider state. ||
|| [`state.infoLayerShown`](#param-state.infoLayerShown) | false | Type: Boolean

Flag that enables displaying the traffic events layer. ||
|#


**Example:**

```javascript
// Creating a provider for current traffic with the traffic events layer enabled
// and putting it on the map.
var actualProvider = new ymaps.traffic.provider.Actual({}, {infoLayerShown: true});
actualProvider.setMap(myMap);

// Forbidding showing balloons for clicks on the infopoint layer.
myMap.layers.options.set({
    // The option name is formed by adding the 'trafficInfo' prefix
    // to the hotspot layer option 'openBalloonOnClick'.
    trafficInfoOpenBalloonOnClick: false
});

// ...
// Deleting the provider from the map.
actualProvider.setMap(null);
```

## Fields {#properties-summary}

#|
|| **Name** | **Type** | **Description** ||
|| [events](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events) | [IEventManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventManager.md) | Event manager.

Inherited from [IEventEmitter](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IEventEmitter.md#events). ||
|| [options](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options) | [IOptionManager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/IOptionManager.md) | Options manager.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#options). ||
|| [state](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/traffic.provider.Actual.md#state) | [data.Manager](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/data.Manager.md) | Provider state. Names of fields that are available via the data.Manager.get method: 
- isInited - Flag for whether the provider is ready to provide data.
- infoLayerShown - Flag for whether the traffic events layer is shown.
- timestamp - Current time in the UTC+0 time zone, in seconds.
- localtime - Local time that the server is currently sending data for, 	in the format HH:MM.
- level - Traffic level in points from 0 to 10.
- isotime - String containing the current date in the format "YYYY-MM-DDThh:mm:ss±hhmm". ||
|#

## Events {#events-summary}

#|
|| **Name** | **Description** ||
|| [optionschange](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange) | Change to the object options.

Inherited from [ICustomizable](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ICustomizable.md#event-optionschange). ||
|#

## Methods {#methods-summary}

#|
|| **Name** | **Returns** | **Description** ||
|| [getMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ITrafficProvider.md#getMap)() | [Map](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/Map.md)\|null | Returns reference to the map.

Inherited from [ITrafficProvider](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ITrafficProvider.md#getMap). ||
|| [setMap](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ITrafficProvider.md#setMap)([Reference](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/ITrafficProvider.md#setMap-param-Reference)) | | ||
|| [update](https://yandex.com.tr/dev/jsapi-v2-1/doc/en/v2-1/ref/reference/traffic.provider.Actual.md#update)() | | Sends a request to update traffic. ||
|#

## Fields details {#field_detail}

### state {#state}

```javascript
{data.Manager} state
```

Provider state. Names of fields that are available via the data.Manager.get method: 
- isInited - Flag for whether the provider is ready to provide data.
- infoLayerShown - Flag for whether the traffic events layer is shown.
- timestamp - Current time in the UTC+0 time zone, in seconds.
- localtime - Local time that the server is currently sending data for, 	in the format HH:MM.
- level - Traffic level in points from 0 to 10.
- isotime - String containing the current date in the format "YYYY-MM-DDThh:mm:ss±hhmm".

**Example:**

```javascript
var actualProvider = new ymaps.traffic.provider.Actual();
actualProvider.setMap(myMap);
actualProvider.state.events.add('change', function () {
    if (actualProvider.state.get('isInited')) {
        alert('The provider is ready to provide data.');
    }
});
```

## Methods details {#method_detail}

### update {#update}

```javascript
{} update()
```

Sends a request to update traffic.

**Example:**

```javascript
var trafficControl = new ymaps.control.TrafficControl({shown: true});
map.controls.add(trafficControl);
function updateProvider () {
     trafficControl.getProvider('traffic#actual').update();
}
// Sending a request to update data every 4 minutes.
window.setInterval(updateProvider, 4 * 60 * 1000);
```
