SiClusterSourceComponent documentation¶
selector
si-cluster-sourceAdds 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¶
| Name | Type | Default | Description |
|---|---|---|---|
| clusterMaxZoom ¶ | number | undefined | Maximum zoom at which points are clustered. |
| clusterMinPoints ¶ | number | 2 | Minimum number of points required to form a cluster. |
| clusterRadius ¶ | number | 50 | Cluster radius in pixels. |
| data ¶ | FeatureCollection<Point, GeoJsonProperties> | EMPTY_DATA | Point 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 | string | ID used to register the generated GeoJSON source in MapLibre. | |
| statusProperty ¶ | string | undefined | Top-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¶
| Name | Type | Description |
|---|---|---|
| clusterClick ¶ | ClusterPoint | Emits when a cluster marker is activated. |
Attributes and Methods¶
| Name | Type | Default | Description |
|---|---|---|---|
| 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¶
import imported from @types/geojson |
|---|
import imported from @types/geojson |
|---|
import imported from @types/geojson |
|---|
| 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. |
|---|
import imported from @types/geojson |
|---|
import imported from @types/geojson |
|---|
| imported from @types/geojson |
|---|
Except where otherwise noted, content on this site is licensed under MIT License.