# MapLibre

**MapLibre** is an open-source library for rendering interactive vector maps with WebGL. Element supports Angular applications that use [`@maplibre/ngx-maplibre-gl`](<https://github.com/maplibre/ngx-maplibre-gl>) with control styles, a theme-aware map style, and translated control labels.

## Usage

MapLibre exposes its map, controls, sources, and layers as composable Angular components and directives. Applications remain responsible for configuring and composing the map.

### When to use

- When direct access to MapLibre features, sources, and layers is required.
- When map controls and behavior need to be composed for a specific use case.
- When vector-map rendering and MapLibre's ecosystem are preferred.
- When 3D features such as pitched views, extruded buildings, or a globe are required.
- When the high-level [Element Maps](<https://element.siemens.io/components/maps/element-maps/>) component does not provide enough flexibility.

## Code

See the [ngx-maplibre-gl documentation](<https://github.com/maplibre/ngx-maplibre-gl>) and the [MapLibre GL JS documentation](<https://maplibre.org/maplibre-gl-js/docs/>) for the complete APIs and configuration options.

> [!NOTE]
>
> **Required Packages**
>
> - [@maplibre/ngx-maplibre-gl](<https://www.npmjs.com/package/@maplibre/ngx-maplibre-gl>)
> - [maplibre-gl](<https://www.npmjs.com/package/maplibre-gl>)

```
npm install --save @siemens/element-ng @siemens/map-styles @siemens/element-translate-ng
npm install --save @maplibre/ngx-maplibre-gl maplibre-gl
```

### Configure the MapLibre worker

MapLibre GL JS 6 loads its web worker from a separate file. Add the worker and its shared module to the application assets in `angular.json`:

```
{
  "architect": {
    "build": {
      "options": {
        "assets": [
          {
            "glob": "maplibre-gl-{worker,shared}.mjs",
            "input": "node_modules/maplibre-gl/dist",
            "output": "/assets/maplibre/"
          }
        ]
      }
    }
  }
}
```

Register the worker in the application configuration before creating a map:

```
import { ApplicationConfig } from '@angular/core';
import { provideMaplibreWorker } from '@maplibre/ngx-maplibre-gl/config';

export const appConfig: ApplicationConfig = {
  providers: [provideMaplibreWorker('assets/maplibre/maplibre-gl-worker.mjs')]
};
```

### Apply Element control styles

Import the Element MapLibre stylesheet in the application's global stylesheet. It provides the required MapLibre layout styles and applies Element styling to controls, popovers, markers, and other map UI.

```
@use '@siemens/element-ng/maplibre/styles';
```

Use this stylesheet instead of importing `maplibre-gl/dist/maplibre-gl.css` separately.

### Apply the Element map style

`injectSiMapStyle()` creates a signal containing the Element MapLibre style. Pass a MapTiler API key to the function and bind the signal value to the map's `mapStyle` input. The style updates automatically when the Element theme changes.

The function must be called in an Angular injection context, such as a component field initializer.

```
import { Component } from '@angular/core';
import { MapComponent } from '@maplibre/ngx-maplibre-gl';
import { injectSiMapStyle } from '@siemens/element-ng/maplibre';

@Component({
  selector: 'app-map',
  imports: [MapComponent],
  template: '<mgl-map class="h-100" [mapStyle]="mapStyle()" />'
})
export class AppMapComponent {
  protected readonly mapStyle = injectSiMapStyle('REPLACE_WITH_YOUR_MAPTILER_KEY');
}
```

### Apply translations

`injectSiMapTranslations()` creates a signal containing translated MapLibre locale strings. It uses the configured Element translation service and updates when the active language changes. Bind the signal value to the map's `locale` input:

```
import { Component } from '@angular/core';
import { MapComponent } from '@maplibre/ngx-maplibre-gl';
import { injectSiMapTranslations } from '@siemens/element-ng/maplibre';

@Component({
  selector: 'app-map',
  imports: [MapComponent],
  template: '<mgl-map class="h-100" [locale]="mapTranslations()" />'
})
export class AppMapComponent {
  protected readonly mapTranslations = injectSiMapTranslations();
}
```

### MapLibre example

The following example combines the Element map style and translations with MapLibre controls.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, signal } from '@angular/core';
import {
  AttributionControlDirective,
  ControlComponent,
  EventData,
  FullscreenControlDirective,
  GeolocateControlDirective,
  GlobeControlDirective,
  MapComponent,
  MarkerComponent,
  NavigationControlDirective,
  PopupComponent,
  Position,
  ScaleControlDirective
} from '@maplibre/ngx-maplibre-gl';
import {
  injectSiMapStyle,
  injectSiMapTranslations,
  MarkerStatus,
  SiStatusMarkerComponent
} from '@siemens/element-ng/maplibre';
import { LOG_EVENT } from '@siemens/live-preview';
import type { MapLibreEvent } from 'maplibre-gl';

import { environment } from '../../../environments/environment';

type StatusPoint = GeoJSON.Feature<
  GeoJSON.Point,
  { name: string; description: string; type: 'status'; status: MarkerStatus }
>;

const buildPoint = (coordinates: number[], status: MarkerStatus): StatusPoint => ({
  type: 'Feature',
  geometry: {
    type: 'Point',
    coordinates
  },
  properties: {
    name: 'marker point',
    description: `Description for marker point`,
    type: 'status',
    status
  }
});

@Component({
  selector: 'app-sample',
  imports: [
    AttributionControlDirective,
    ControlComponent,
    FullscreenControlDirective,
    GeolocateControlDirective,
    GlobeControlDirective,
    MapComponent,
    MarkerComponent,
    NavigationControlDirective,
    PopupComponent,
    ScaleControlDirective,
    SiStatusMarkerComponent
  ],
  templateUrl: './maplibre.html',
  host: {
    class: 'h-100 d-flex flex-column p-5'
  }
})
export class SampleComponent {
  protected readonly logEvent = inject(LOG_EVENT);
  protected readonly mapStyle = injectSiMapStyle(environment.maptilerKey);
  protected readonly mapTranslations = injectSiMapTranslations();
  protected readonly points = signal<StatusPoint[]>([
    buildPoint([11.34774, 48.138848], 'default'),
    buildPoint([11.24774, 48.258848], 'unknown'),
    buildPoint([11.18037, 48.258848], 'success'),
    buildPoint([11.54774, 48.158848], 'info'),
    buildPoint([11.51274, 48.178848], 'warning'),
    buildPoint([11.54774, 48.178848], 'danger'),
    buildPoint([11.37774, 48.288848], 'caution'),
    buildPoint([11.52774, 48.280848], 'critical')
  ]);

  protected onError(event: ErrorEvent & EventData): void {
    if (event.error.message) {
      this.logEvent('map error', event.error.message);
    } else {
      this.logEvent('map error', event.error);
    }
  }

  protected onGeolocate(position: Position): void {
    this.logEvent('geolocate', position);
  }

  protected onResize(event: MapLibreEvent): void {
    const canvas = event.target.getCanvas();
    this.logEvent('resize', { width: canvas.clientWidth, height: canvas.clientHeight });
  }
}
```

Template:

```html
<mgl-map
  class="h-100"
  [attributionControl]="false"
  [locale]="mapTranslations()"
  [mapStyle]="mapStyle()"
  [center]="[11.6, 48.1]"
  [canvasContextAttributes]="{ preserveDrawingBuffer: true }"
  [zoom]="10"
  (mapError)="onError($event)"
  (mapResize)="onResize($event)"
>
  <mgl-control mglFullscreen />
  <mgl-control mglGlobe position="top-right" />
  <mgl-control mglScale unit="metric" position="top-right" />
  <mgl-control mglAttribution position="bottom-left" />
  <mgl-control mglNavigation position="bottom-right" />
  <mgl-control mglGeolocate position="bottom-right" (geolocate)="onGeolocate($event)" />
  @for (point of points(); track point) {
    <!--
      Only use this if you really need to use HTML/Angular component to render your symbol.
      These markers are slow compared to a Layer of symbol because they're not rendered using WebGL.
    -->
    <mgl-marker #marker [feature]="point">
      <si-status-marker [status]="point.properties.status" />
    </mgl-marker>
    <mgl-popup [marker]="marker">
      <dl class="mb-0">
        <dt>Name</dt>
        <dd>{{ point.properties.name }}</dd>
        <dt>Description</dt>
        <dd>{{ point.properties.description }}</dd>
        <dt>Status</dt>
        <dd>{{ point.properties.status }}</dd>
        <dt>Coordinates</dt>
        <dd>{{ point.geometry.coordinates[0] }}, {{ point.geometry.coordinates[1] }}</dd>
      </dl>
    </mgl-popup>
  }
</mgl-map>
```

### Cluster example

The following example uses `SiClusterSourceComponent` to cluster GeoJSON points and `SiStatusMarkerComponent` for unclustered markers. Cluster markers show the number of contained points and their distribution by group or status.

Clicking a cluster frames all of its children and zooms in as far as possible while they stay visible. The animation is skipped when `prefers-reduced-motion` is set. Zooming stops at `clusterMaxZoom`, above which points are no longer clustered. Clusters whose children stay within `clusterRadius` up to that zoom cannot be pulled apart, so they emit `clusterClick` and open the projected popover instead. Set `zoomOnClick` to `false` to always open the popover, as the switch in the example demonstrates.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, signal } from '@angular/core';
import { form, FormField } from '@angular/forms/signals';
import {
  AttributionControlDirective,
  ControlComponent,
  EventData,
  FullscreenControlDirective,
  GeolocateControlDirective,
  GlobeControlDirective,
  MapComponent,
  MarkersForClustersComponent,
  NavigationControlDirective,
  PointDirective,
  Position,
  ScaleControlDirective
} from '@maplibre/ngx-maplibre-gl';
import { provideSiFormFieldConfig, SiFormFieldComponent } from '@siemens/element-ng/form';
import {
  injectSiMapStyle,
  injectSiMapTranslations,
  ClusterPoint,
  SiClusterPopoverComponent,
  SiClusterSourceComponent,
  SiStatusMarkerComponent
} from '@siemens/element-ng/maplibre';
import { LOG_EVENT } from '@siemens/live-preview';
import { MapPoint } from '@siemens/maps-ng';

import { environment } from '../../../environments/environment';
import { mockPoints } from '../../mocks/points.mock';

const buildGeoJSON = (points: MapPoint[]): GeoJSON.FeatureCollection<GeoJSON.Point> => ({
  type: 'FeatureCollection',
  features: points.map(point => ({
    type: 'Feature',
    geometry: {
      type: 'Point',
      coordinates: [point.lon, point.lat]
    },
    properties: {
      description: point.description,
      group: point.group,
      marker: point.marker?.type ?? 'default',
      name: point.name,
      status: point.marker?.status
    }
  }))
});

@Component({
  selector: 'app-sample',
  imports: [
    AttributionControlDirective,
    ControlComponent,
    FormField,
    FullscreenControlDirective,
    GeolocateControlDirective,
    GlobeControlDirective,
    MapComponent,
    MarkersForClustersComponent,
    NavigationControlDirective,
    PointDirective,
    ScaleControlDirective,
    SiClusterPopoverComponent,
    SiClusterSourceComponent,
    SiFormFieldComponent,
    SiStatusMarkerComponent
  ],
  templateUrl: './maplibre-cluster.html',
  providers: [provideSiFormFieldConfig()],
  host: {
    class: 'h-100 d-flex flex-column p-5'
  }
})
export class SampleComponent {
  protected readonly logEvent = inject(LOG_EVENT);
  protected readonly mapStyle = injectSiMapStyle(environment.maptilerKey);
  protected readonly mapTranslations = injectSiMapTranslations();

  protected readonly geoJson = buildGeoJSON(mockPoints);
  protected readonly zoomOnClick = signal(true);
  protected readonly zoomOnClickField = form(this.zoomOnClick);

  protected selectCluster(feature: ClusterPoint): void {
    this.logEvent('cluster click', feature.properties);
  }

  protected onError(event: ErrorEvent & EventData): void {
    if (event.error.message) {
      this.logEvent('map error', event.error.message);
    } else {
      this.logEvent('map error', event.error);
    }
  }

  protected onGeolocate(position: Position): void {
    this.logEvent('geolocate', position);
  }
}
```

Template:

```html
<mgl-map
  class="flex-grow-1"
  [attributionControl]="false"
  [locale]="mapTranslations()"
  [mapStyle]="mapStyle()"
  [center]="[8.0, 47.1]"
  [canvasContextAttributes]="{ preserveDrawingBuffer: true }"
  [zoom]="4"
  (mapError)="onError($event)"
>
  <mgl-control mglFullscreen />
  <mgl-control mglGlobe position="top-right" />
  <mgl-control mglScale unit="metric" position="top-right" />
  <mgl-control mglAttribution position="bottom-left" />
  <mgl-control mglNavigation position="bottom-right" />
  <mgl-control mglGeolocate position="bottom-right" (geolocate)="onGeolocate($event)" />

  <si-cluster-source
    sourceId="cluster-source"
    statusProperty="status"
    [data]="geoJson"
    [zoomOnClick]="zoomOnClick()"
    (clusterClick)="selectCluster($event)"
  >
    <!-- Required for vrt tests to avoid the popover close when the map size change -->
    <si-cluster-popover closeOnMove="false" />
  </si-cluster-source>

  <mgl-markers-for-clusters source="cluster-source">
    <ng-template let-feature mglPoint>
      <si-status-marker [status]="feature.properties?.status" />
    </ng-template>
  </mgl-markers-for-clusters>
</mgl-map>
<div class="py-6 e2e-ignore">
  <div class="card">
    <div class="card-header">Control panel</div>
    <div class="card-body">
      <si-form-field class="form-switch mb-5" label="Zoom into clusters on click">
        <input
          type="checkbox"
          role="switch"
          class="form-check-input"
          [formField]="zoomOnClickField"
        />
      </si-form-field>
    </div>
  </div>
</div>
```

### 3D buildings example

MapLibre GL renders maps with WebGL, so the camera can be pitched and vector-tile buildings can be extruded into 3D.

The example pitches the map and adds a `fill-extrusion` layer on the OpenMapTiles `building` source. Building height animates in between zoom 15 and 16 using the `render_height` and `render_min_height` properties from the tiles.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, computed, inject } from '@angular/core';
import {
  AttributionControlDirective,
  ControlComponent,
  EventData,
  FullscreenControlDirective,
  GeolocateControlDirective,
  GlobeControlDirective,
  LayerComponent,
  MapComponent,
  NavigationControlDirective,
  Position,
  ScaleControlDirective
} from '@maplibre/ngx-maplibre-gl';
import { injectSiMapStyle, injectSiMapTranslations } from '@siemens/element-ng/maplibre';
import { injectIsDarkTheme } from '@siemens/element-ng/theme';
import { LOG_EVENT } from '@siemens/live-preview';
import type {
  ExpressionSpecification,
  FillExtrusionLayerSpecification,
  FilterSpecification
} from 'maplibre-gl';

import { environment } from '../../../environments/environment';

@Component({
  selector: 'app-sample',
  imports: [
    AttributionControlDirective,
    ControlComponent,
    FullscreenControlDirective,
    GeolocateControlDirective,
    GlobeControlDirective,
    LayerComponent,
    MapComponent,
    NavigationControlDirective,
    ScaleControlDirective
  ],
  templateUrl: './maplibre-3d-buildings.html',
  host: {
    class: 'h-100 d-flex flex-column p-5'
  }
})
export class SampleComponent {
  protected readonly logEvent = inject(LOG_EVENT);
  protected readonly mapStyle = injectSiMapStyle(environment.maptilerKey);
  protected readonly mapTranslations = injectSiMapTranslations();
  private readonly isDark = injectIsDarkTheme();

  protected readonly buildingFilter = [
    '!=',
    ['get', 'hide_3d'],
    true
  ] as unknown as FilterSpecification;

  protected readonly buildingPaint = computed<FillExtrusionLayerSpecification['paint']>(() => ({
    'fill-extrusion-color': this.isDark() ? 'rgba(7, 72, 89, 1)' : 'rgba(164, 146, 127, 1)',
    'fill-extrusion-opacity': 0.85,
    // Animate height from 0 to render_height between zoom 15 and 16.
    'fill-extrusion-height': [
      'interpolate',
      ['linear'],
      ['zoom'],
      15,
      0,
      16,
      ['get', 'render_height']
    ] as ExpressionSpecification,
    'fill-extrusion-base': [
      'interpolate',
      ['linear'],
      ['zoom'],
      15,
      0,
      16,
      ['get', 'render_min_height']
    ] as ExpressionSpecification
  }));

  protected onError(event: ErrorEvent & EventData): void {
    if (event.error.message) {
      this.logEvent('map error', event.error.message);
    } else {
      this.logEvent('map error', event.error);
    }
  }

  protected onGeolocate(position: Position): void {
    this.logEvent('geolocate', position);
  }
}
```

Template:

```html
<mgl-map
  class="h-100"
  [attributionControl]="false"
  [locale]="mapTranslations()"
  [mapStyle]="mapStyle()"
  [center]="[11.6, 48.1]"
  [canvasContextAttributes]="{ preserveDrawingBuffer: true, antialias: true }"
  [zoom]="16"
  [pitch]="40"
  (mapError)="onError($event)"
>
  <mgl-layer
    id="3d-buildings"
    type="fill-extrusion"
    source="openmaptiles"
    sourceLayer="building"
    before="watername_ocean"
    [minzoom]="15"
    [filter]="buildingFilter"
    [paint]="buildingPaint()"
  />
  <mgl-control mglFullscreen />
  <mgl-control mglGlobe position="top-right" />
  <mgl-control mglScale unit="metric" position="top-right" />
  <mgl-control mglAttribution position="bottom-left" />
  <mgl-control mglNavigation position="bottom-right" />
  <mgl-control mglGeolocate position="bottom-right" (geolocate)="onGeolocate($event)" />
</mgl-map>
```

### Custom cluster popover

Use an `ng-template` with `siClusterPopoverTemplate` to customize the list of loaded cluster features. This example displays each location's name, description, and status as a selectable list item. Selecting a location updates the status above the map and logs the feature.

The popover handles loading and error states for both default and custom content. The "Load more" button appears after the first batch is loaded. If a request fails, an alert appears at the end of the list and the same button becomes "Retry", preserving focus and already loaded locations. Retrying reloads only the failed batch.

The `pageSize` input controls how many locations are loaded initially and with each click. Loaded locations stay visible while the next batch loads, with feature actions temporarily disabled. New locations are appended to the list.

Both default and custom content scroll below the fixed header. The centered "Load more" button sits at the end of the scrolling content and moves below newly appended locations. By default, the close button receives initial focus. Focus stays on "Load more" while loading and after items are appended, keeping the button visible. When all locations are loaded and the button disappears, focus moves to the scrolling region, so pressing Enter again does not close the popover.

#### Example

Component:

```typescript
/**
 * Copyright (c) Siemens 2016 - 2026
 * SPDX-License-Identifier: MIT
 */
import { Component, inject, signal } from '@angular/core';
import {
  AttributionControlDirective,
  ControlComponent,
  EventData,
  FullscreenControlDirective,
  MapComponent,
  MarkersForClustersComponent,
  NavigationControlDirective,
  PointDirective
} from '@maplibre/ngx-maplibre-gl';
import {
  ClusterPoint,
  injectSiMapStyle,
  injectSiMapTranslations,
  SiClusterPopoverComponent,
  SiClusterPopoverTemplateDirective,
  SiClusterSourceComponent,
  SiStatusMarkerComponent
} from '@siemens/element-ng/maplibre';
import { LOG_EVENT } from '@siemens/live-preview';

import { environment } from '../../../environments/environment';
import { mockPoints } from '../../mocks/points.mock';

@Component({
  selector: 'app-sample',
  imports: [
    AttributionControlDirective,
    ControlComponent,
    FullscreenControlDirective,
    MapComponent,
    MarkersForClustersComponent,
    NavigationControlDirective,
    PointDirective,
    SiClusterPopoverComponent,
    SiClusterPopoverTemplateDirective,
    SiClusterSourceComponent,
    SiStatusMarkerComponent
  ],
  templateUrl: './maplibre-cluster-custom-popover.html',
  styleUrl: './maplibre-cluster-custom-popover.scss',
  host: {
    class: 'h-100 d-flex flex-column p-5'
  }
})
export class SampleComponent {
  protected readonly logEvent = inject(LOG_EVENT);
  protected readonly mapStyle = injectSiMapStyle(environment.maptilerKey);
  protected readonly mapTranslations = injectSiMapTranslations();
  protected readonly selectedFeature = signal<ClusterPoint | undefined>(undefined);
  protected readonly geoJson: GeoJSON.FeatureCollection<GeoJSON.Point> = {
    type: 'FeatureCollection',
    features: mockPoints.map((point, index) => ({
      type: 'Feature',
      id: index,
      geometry: {
        type: 'Point',
        coordinates: [point.lon, point.lat]
      },
      properties: {
        name: point.name,
        description: point.description,
        group: point.group,
        status: point.marker?.status
      }
    }))
  };

  protected selectFeature(feature: ClusterPoint): void {
    this.selectedFeature.set(feature);
    this.logEvent('select location', feature);
  }

  protected onError(event: ErrorEvent & EventData): void {
    if (event.error.message) {
      this.logEvent('map error', event.error.message);
    } else {
      this.logEvent('map error', event.error);
    }
  }
}
```

Template:

```html
<p class="mb-4" role="status">
  @if (selectedFeature(); as feature) {
    Selected location: {{ feature.properties?.name }}
  } @else {
    Open a cluster and select a location from its popover.
  }
</p>
<mgl-map
  class="flex-grow-1"
  [attributionControl]="false"
  [locale]="mapTranslations()"
  [mapStyle]="mapStyle()"
  [center]="[8.0, 47.1]"
  [canvasContextAttributes]="{ preserveDrawingBuffer: true }"
  [zoom]="4"
  (mapError)="onError($event)"
>
  <mgl-control mglFullscreen />
  <mgl-control mglAttribution position="bottom-left" />
  <mgl-control mglNavigation position="bottom-right" />

  <si-cluster-source sourceId="cluster-source" statusProperty="status" [data]="geoJson">
    <si-cluster-popover maxWidth="420px" pageSize="5">
      <ng-template let-features siClusterPopoverTemplate>
        <div class="cluster-popover-content">
          <ul class="list-unstyled mb-0">
            @for (feature of features; track feature.id) {
              <li>
                <button
                  type="button"
                  class="list-item list-item-action"
                  (click)="selectFeature(feature)"
                >
                  <si-status-marker
                    class="list-item-indicator"
                    [status]="feature.properties?.status"
                  />
                  <h5 class="list-item-title">
                    {{ feature.properties?.name }}
                  </h5>
                  <div class="list-item-description mb-0 si-body">{{
                    feature.properties?.description
                  }}</div>
                </button>
              </li>
            }
          </ul>
        </div>
      </ng-template>
    </si-cluster-popover>
  </si-cluster-source>

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

### [SiClusterSourceComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L91-L270>)

**Kind:** component

**Selector:** `si-cluster-source`

```
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

```html
<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>
```

```
component SiClusterSourceComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [clusterMaxZoom](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L134-L134>) | `number \| undefined` | `undefined` | Maximum zoom at which points are clustered. |
| [clusterMinPoints](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L139-L139>) | `number` | `2` | Minimum number of points required to form a cluster. |
| [clusterRadius](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L129-L129>) | `number` | `50` | Cluster radius in pixels. |
| [data](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L103-L103>) | `FeatureCollection<Point, GeoJsonProperties>` | `EMPTY_DATA` | Point feature collection to cluster. |
| [groupColors](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L114-L114>) | `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](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L108-L108>) | `string` | `'group'` | Feature property containing the positive numeric group ID. |
| [sourceId](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L98-L98>) (required) | `string` |  | ID used to register the generated GeoJSON source in MapLibre. |
| [statusProperty](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L124-L124>) | `string \| undefined` | `undefined` | Top-level feature property containing a [MarkerStatus](<../../../api/siemens/element-ng/types/MarkerStatus/index.html#t: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.<br><br>See: [https://maplibre.org/maplibre-style-spec/sources/\#clusterproperties](<https://maplibre.org/maplibre-style-spec/sources/#clusterproperties>) |
| [zoomMaxLevel](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L152-L152>) | `number \| undefined` | `undefined` | Highest zoom used to expand a cluster. Clusters whose children stay within `clusterRadius` up to this zoom emit `clusterClick` instead of zooming. Defaults to `clusterMaxZoom`, because points stop being clustered above it. |
| [zoomOnClick](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L145-L145>) | `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 `clusterClick` instead. |

#### Output Properties

| Name | Type | Description |
| --- | --- | --- |
| [clusterClick](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L157-L157>) | `ClusterPoint` | Emits when a cluster marker is activated and the click did not expand the cluster, either because `zoomOnClick` is disabled or because the children cannot be pulled apart. |

#### Attributes and Methods

##### getClusterLeaves

[Source for getClusterLeaves](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L173-L175>)

Returns a page of original points belonging to a cluster.

See: [https://maplibre.org/maplibre-gl-js/docs/API/classes/GeoJSONSource/\#getclusterleaves](<https://maplibre.org/maplibre-gl-js/docs/API/classes/GeoJSONSource/#getclusterleaves>)

```
getClusterLeaves(clusterId: number, limit: number, offset: number): Promise<ClusterPoint[]>
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [clusterId](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L173-L173>) | `number` |  |  |
| [limit](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L173-L173>) | `number` |  |  |
| [offset](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-source.component.ts#L173-L173>) | `number` |  |  |

**Returns:** [Promise](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise>)`<`[ClusterPoint](<../../../api/siemens/element-ng/types/ClusterPoint/index.html#t:ClusterPoint>)`[]>`

### [SiClusterPopoverComponent](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover.component.ts#L55-L303>)

**Kind:** component

**Selector:** `si-cluster-popover`

```
import { SiClusterPopoverComponent } from '@siemens/element-ng/maplibre';
```

Optional popup with incrementally loaded locations projected into a `si-cluster-source`.

```
component SiClusterPopoverComponent
```

#### Input Properties

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [closeOnMove](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover.component.ts#L73-L73>) | `boolean` | `true` | Whether the popup closes when the map moves. |
| [descriptionProperty](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover.component.ts#L88-L88>) | `string` | `'description'` | Feature property displayed as the description in the default list. |
| [labelProperty](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover.component.ts#L83-L83>) | `string` | `'name'` | Feature property displayed in the default list. |
| [maxWidth](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover.component.ts#L68-L68>) | `string` | `'320px'` | Maximum width passed to the MapLibre popup. |
| [pageSize](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover.component.ts#L78-L78>) | `number` | `8` | Number of locations loaded initially and with each "Load more" action. |

### [SiClusterPopoverTemplateDirective](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-cluster-popover-template.directive.ts#L20-L28>)

**Kind:** directive

**Selector:** `[siClusterPopoverTemplate]`

```
import { SiClusterPopoverTemplateDirective } from '@siemens/element-ng/maplibre';
```

Template for custom location content inside `si-cluster-popover`.

Receives a [ClusterPopoverContext](<../../../api/siemens/element-ng/types/ClusterPopoverContext/index.html#t:ClusterPopoverContext>) with all locations loaded so far. Loading feedback, error recovery, and the "Load more" button are handled by the popover.

```
directive SiClusterPopoverTemplateDirective
```
