RemoteObjectManager

RemoteObjectManager operates in the same way as LoadingObjectManager. When displaying a large number of objects, the manager only loads necessary data, which significantly reduces the volume of traffic. It differs from LoadingObjectManager in that RemoteObjectManager does not clusterize objects itself, but it can use the results of server clustering of data.

Note

RemoteObjectManager doesn't allow dragging objects (it doesn't support the draggable option). Objects are displayed only in the central world and do not jump over when the map is dredged.

It also doesn't support object editing.

RemoteObjectManager is a layer containing a JSON description of objects being added to the map — placemarks and clusters. The description must contain the coordinates and IDs of the objects, information about their geometries, and properties, such as balloon contents. For more information about the format for describing objects, see the section Developing the backend.

Example of a JSON description of objects
{
  "type": "FeatureCollection",
  "features": [
    {
      "type": "Feature",
      "id": 0,
      "geometry": {
        "type": "Point",
        "coordinates": [55.831903, 37.411961]
      },
      "properties": {
        "balloonContent": "Balloon content",
        "clusterCaption": "Placemark 1",
        "hintContent": "Hint text"
      }
    },
    {
      // Cluster description.
      type: 'Cluster',
      // The cluster ID is created independently.
      id: 1,
      bbox: [[35, 46], [46, 57]],
      number: 34,
      // An array describing 34 objects in the cluster.
      // Optional.
      features: [...],
      geometry: {
        type: 'Point',
        coordinates: [40.5, 51]
      },
      properties: {
        iconContent: 34
      }
    },
    {
      "type": "Feature",
      "id": 2,
      "geometry": {
        "type": "Point",
        "coordinates": [55.763338, 37.565466]
      },
      "properties": {
        "balloonContent": "Balloon content",
        "clusterCaption": "Placemark 2",
        "hintContent": "Hint text"
      }
    }
  ]
}

The ID uniquely identifies each object of the manager. You can use the ID to get access to the desired object and, for example, change its properties or options. Object IDs are required attributes and must be created independently.

This is how RemoteObjectManager works: When creating the manager, the developer specifies the URL template that the manager will use for forming requests to the server to get necessary data. The manager requests object data from the server only for the tiles that fall within the map viewport. However, data is loaded for the entire tile, even if a given tile does not completely fall within the viewport.

The manager stores the downloaded data on the client side. When the user moves the map, the manager checks whether the data was previously loaded for the new viewport area, and loads it from the server if necessary.

Each time the map zoom changes, the manager requests data from the server again for the entire viewport. The reason for this is that RemoteObjectManager is configured to optimally display results of server clusterization. The manager does not perform any data processing on the client side — it only displays what it receives in the request from the server. If object clusterization is used on the server, different zoom levels may result in data for different objects being in the request (see the picture below). For this reason, when the zoom level changes, the manager resends the data request, even if that data was previously loaded at a different zoom level.

The manager and server exchange data in JSONP format. This means that the server must return data wrapped in a callback function. The developer must independently implement data processing on the server, making sure that the server returns data in the correct format.

Based on the loaded data, RemoteObjectManager creates overlays, which it then adds to the map. Overlays are visual representations of objects on the map. Processing them requires fewer resources than processing geo objects (instances of the GeoObject class). The manager only creates overlays for the objects that fall within the map viewport.