Documentation
Reference
2.1.55 (current version)
collection
interactivityModel
Interfaces

Developing the backend

To work with RemoteObjectManager, the developer must design the backend architecture. First of all, you need to determine how data will be stored on the server, and how requests from the client will be processed. You also need to organize server data caching.

RemoteObjectManager operates in the same way as LoadingObjectManager. It loads the necessary data to the client side using the URL specified when creating the manager. The main difference is that RemoteObjectManager does not clusterize data on the client side, but it can display results of server clusterization. Depending on the complexity of the task, the developer chooses an appropriate algorithm for clusterization.

The same as LoadingObjectManager, RemoteObjectManager supports two data loading modes: for the entire viewport, and by separate tiles. The data loading mode is taken into account when developing the backend. The section Developing the backend for LoadingObjectManager covers the loading modes, along with recommendations for storing data on the server.

Object description format

The description of objects is given in JSON format. It must contain the coordinates and IDs of the objects, information about their geometries, and object properties, such as balloon contents.

In order for the results of server clustering to be displayed on the map, the client must receive the JSON description containing information about both placemarks and clusters. The cluster description is set in an object with the 'Cluster' type and can contain the following fields:

  • type - Object type; always 'Cluster' for clusters.
  • id - Unique cluster ID.
  • geometry - The cluster geometry in JSON format.
  • bbox - An array of coordinates describing a rectangular area which includes all cluster objects.
  • number - Number of objects in the cluster.
  • features - An array of cluster objects. Optional field. If this field is omitted or empty, an empty cluster icon will be shown on the map.
  • properties - Cluster data.

By default, cluster icons are displayed in a standard blue color.

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: {
        //If the iconContent field is omitted, 
        // the cluster icon will display the value from the 'number' field.                 
        iconContent: 'Cluster 1'                     
      }
    }
    {
      "type": "Feature",
      "id": 2,
      "geometry": {
        "type": "Point",
        "coordinates": [55.763338, 37.565466]
      },
      "properties": {
        "balloonContent": "Balloon content",
        "clusterCaption": "Placemark 2",
        "hintContent": "Hint text"
      }
    }
  ]
}