SiClusterSourceComponent documentation¶
import { SiClusterSourceComponent } from '@siemens/element-ng/maplibre'; 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.
Clicking a cluster frames all of its children and zooms in as far as possible while they stay visible, up to the zoom at which points stop being clustered. Clusters whose children stay within clusterRadius until then emit clusterClick instead, which opens a projected si-cluster-popover.
Example:
Basic usage
<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 | 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 |
| groupProperty ¶ | string | 'group' | Feature property containing the positive numeric group ID. |
| sourceId required ¶ | string | ID used to register the generated GeoJSON source in MapLibre. | |
| statusProperty ¶ | string | undefined | 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 See: https://maplibre.org/maplibre-style-spec/sources/#clusterproperties |
| zoomMaxLevel ¶ | number | undefined | undefined | Highest zoom used to expand a cluster. Clusters whose children stay within |
| zoomOnClick ¶ | boolean | false | Frames the children of a clicked cluster and zooms in as far as possible while they stay visible. Clusters whose children cannot be pulled apart emit |
Output Properties¶
| Name | Type | Description |
|---|---|---|
| clusterClick ¶ | ClusterPoint | Emits when a cluster marker is activated and the click did not expand the cluster, either because |
Attributes and Methods¶
| Name | Type | 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 |
Types Documentation¶
Built-in group palette or exact colors indexed by positive group ID. The import type { ClusterColors } from '@siemens/element-ng/maplibre';'status' palette is the four-color palette used for numeric groups; it is separate from status-based bucketing.
A point feature consumed by the clustered MapLibre source.import type { ClusterPoint } from '@siemens/element-ng/maplibre';
Except where otherwise noted, content on this site is licensed under MIT License.