getClusterLeaves method

Future<Object?> getClusterLeaves(
  1. String sourceId,
  2. int clusterId,
  3. int limit,
  4. int offset,
)

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

clusterId is the "cluster_id" property of a cluster feature. The result is a GeoJSON feature collection of the original point features. It skips the first offset points and then holds up to limit of them, so a limit of 0 gives an empty collection.

A cluster ID can go out of date as RenderSessionHandle.getClusterChildren() describes.

See mln_render_session_get_cluster_leaves 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?> getClusterLeaves(
  String sourceId,
  int clusterId,
  int limit,
  int offset,
) => _query(
  _resultObjectOrNull,
  (arena, completion) => raw.mln_render_session_get_cluster_leaves(
    _handle.raw,
    nativeStringView(sourceId, arena).value,
    _nativeInteger(clusterId, 0, 4294967295),
    _nativeInteger(limit, 0, 4294967295),
    _nativeInteger(offset, 0, 4294967295),
    completion,
    nativeDiagnostic,
  ),
);