Skip to content

SiClusterSourceComponent documentation

selector
si-cluster-source

Adds a clustered GeoJSON source to a MapLibre map and renders interactive cluster markers.

Cluster markers display the number of contained points and their distribution by group. Status segments can be enabled for ungrouped points by providing statusProperty . Render individual, unclustered points separately with mgl-markers-for-clusters using the same source ID. Positive numeric groups always take precedence over status segments. Status segments apply only when the normalized group value is zero; points without a matching group or status use the ungrouped color.

Example:

<mgl-map [mapStyle]="mapStyle()">
  <si-cluster-source
    sourceId="locations"
    statusProperty="status"
    [data]="locations"
    (clusterClick)="onClusterClick($event)"
  />

  <mgl-markers-for-clusters source="locations">
    <ng-template let-feature mglPoint>
      <si-status-marker
        [status]="feature.properties?.status"
      />
    </ng-template>
  </mgl-markers-for-clusters>
</mgl-map>

Input Properties

NameTypeDefaultDescription
clusterMaxZoom
numberundefinedMaximum zoom at which points are clustered.
clusterMinPoints
number2Minimum number of points required to form a cluster.
clusterRadius
number50Cluster radius in pixels.
data
FeatureCollection<Point, GeoJsonProperties>EMPTY_DATAPoint feature collection to cluster.
groupColors
ClusterColors'status'Built-in palette or exact colors indexed by group ID. The built-in 'status' palette contains four colors for numeric groups and is separate from status-based bucketing.
groupProperty
string'group'Feature property containing the positive numeric group ID.
sourceId
Required
stringID used to register the generated GeoJSON source in MapLibre.
statusProperty
stringundefinedTop-level feature property containing a MarkerStatus value. Status bucketing is disabled by default and only applies when the normalized group value is zero. Missing or unsupported status values, and groups that do not match a configured bucket, use the ungrouped color. Built-in colors match SiStatusMarkerComponent , with default using accent and unknown using neutral.
See https://maplibre.org/maplibre-style-spec/sources/#clusterproperties

Output Properties

NameTypeDescription
clusterClick
ClusterPointEmits when a cluster marker is activated.

Attributes and Methods

NameTypeDefaultDescription
getClusterLeaves(...)
(clusterId: number, limit: number, offset: number) => Promise<ClusterPoint[]>Returns a page of original points belonging to a cluster.
See https://maplibre.org/maplibre-gl-js/docs/API/classes/GeoJSONSource/#getclusterleaves

Parameters

Types Documentation

imported from @types/geojson
import
imported from @types/geojson
imported from @types/geojson
("status" | "element" | Record<number, string>)
Built-in group palette or exact colors indexed by positive group ID. The 'status' palette is the four-color palette used for numeric groups; it is separate from status-based bucketing.
Status values supported by status markers and cluster status segments.
A point feature consumed by the clustered MapLibre source.
imported from @types/geojson
imported from @types/geojson
imported from @types/geojson
("success" | "info" | "warning" | "danger" | "caution" | "critical")

Except where otherwise noted, content on this site is licensed under MIT License.