getClusterChildren method

Future<Object?> getClusterChildren(
  1. String sourceId,
  2. int clusterId
)

Reads the children of a cluster in a clustered GeoJSON source.

clusterId is the "cluster_id" property of a cluster feature. The result is a GeoJSON feature collection of the clusters and points that the cluster splits into at the next zoom level.

The query reads the source's data from the session's most recent render attempt, so a change to the data shows once the session tries to render again.

A cluster ID belongs to one version of the source's data. After the data changes, feature queries can return IDs from the earlier version until the source's tiles reload, and such an ID completes with Status.notFound or names a different cluster. Query the features again for current IDs.

See mln_render_session_get_cluster_children in the C API reference.

Errors:

  • Status.notFound when the session's most recent render attempt had no source named sourceId, or the source has no cluster clusterId.
  • Status.invalidArgument when the source isn't a GeoJSON source with clustering turned on.

Implementation

Future<Object?> getClusterChildren(String sourceId, int clusterId) => _query(
  _resultObjectOrNull,
  (arena, completion) => raw.mln_render_session_get_cluster_children(
    _handle.raw,
    nativeStringView(sourceId, arena).value,
    _nativeInteger(clusterId, 0, 4294967295),
    completion,
    nativeDiagnostic,
  ),
);