# MapService documentation

**Kind:** class

**Provided in:** `root`

```
import { MapService } from '@siemens/maps-ng';
```

```
undecorated_class MapService
```

#### Attributes and Methods

##### clusterLayer

[Source for clusterLayer](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L220-L240>)

Initialize animated cluster layer for points if clustering is enabled

```
clusterLayer(features: Feature<Geometry, { [x: string]: any; }>[], markerAnimation: boolean, clusterDistance: number, multiWorld: boolean): Layer<Source, default<any>, { [x: string]: any; }>
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [features](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L221-L221>) | `Feature<Geometry, { [x: string]: any; }>[]` |  | • for the source |
| [markerAnimation](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L222-L222>) | `boolean` |  | • animation value for markers |
| [clusterDistance](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L223-L223>) | `number` |  | • number distance between clusters |
| [multiWorld](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L224-L224>) | `boolean` |  | • boolean if points should be repeated on multiple world maps |

**Returns:** [Layer](<https://openlayers.org/>)`<`[Source](<https://openlayers.org/>)`, default<any>, { [x: string]: any; }>`

##### createFeatures

[Source for createFeatures](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L195-L211>)

Create feature with parameters

```
createFeatures(points: MapPoint[], alwaysShowLabels?: boolean = false): Feature<Geometry, { [x: string]: any; }>[]
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [points](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L195-L195>) | `MapPoint[]` |  | • the list of points |
| [alwaysShowLabels](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L195-L195>) (optional) | `boolean` | `false` |  |

**Returns:** [Feature](<https://openlayers.org/>)`<`[Geometry](<https://openlayers.org/>)`, { [x: `[string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)`]: `[any](<https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any>)`; }>[]`

##### getClusterStyle

[Source for getClusterStyle](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L298-L343>)

Cluster styling

```
getClusterStyle(feature: Feature<Geometry, { [x: string]: any; }>): Style[]
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [feature](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L298-L298>) | `Feature<Geometry, { [x: string]: any; }>` |  | • Feature |

**Returns:** [Style](<https://openlayers.org/>)`[]`

##### getFeatureStyle

[Source for getFeatureStyle](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L351-L385>)

Separate feature styling with icon

```
getFeatureStyle(feature: Feature<Geometry, { [x: string]: any; }>, cluster: boolean, features: Feature<Geometry, { [x: string]: any; }>[], dummy?: boolean = false): Style[]
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [feature](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L351-L351>) | `Feature<Geometry, { [x: string]: any; }>` |  | • to style |
| [cluster](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L351-L351>) | `boolean` |  | • indication |
| [features](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L351-L351>) | `Feature<Geometry, { [x: string]: any; }>[]` |  | • list of features |
| [dummy](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L351-L351>) (optional) | `boolean` | `false` |  |

**Returns:** [Style](<https://openlayers.org/>)`[]`

##### getLabelStyle

[Source for getLabelStyle](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L387-L446>)

```
getLabelStyle(feature: Feature<Point, { [x: string]: any; }>, features: Feature<Point, { [x: string]: any; }>[], maxLabelLength: number, maxLines: number, clusterSource?: Cluster<Feature<Point, { [x: string]: any; }>>, dummy?: boolean = false): Style[]
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [feature](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L388-L388>) | `Feature<Point, { [x: string]: any; }>` |  |  |
| [features](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L389-L389>) | `Feature<Point, { [x: string]: any; }>[]` |  |  |
| [maxLabelLength](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L390-L390>) | `number` |  |  |
| [maxLines](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L391-L391>) | `number` |  |  |
| [clusterSource](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L392-L392>) (optional) | `Cluster<Feature<Point, { [x: string]: any; }>>` |  |  |
| [dummy](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L393-L393>) (optional) | `boolean` | `false` |  |

**Returns:** [Style](<https://openlayers.org/>)`[]`

##### getMarkerOffset

[Source for getMarkerOffset](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L448-L454>)

```
getMarkerOffset(feature: Feature<Geometry, { [x: string]: any; }>): [number, number]
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [feature](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L448-L448>) | `Feature<Geometry, { [x: string]: any; }>` |  |  |

**Returns:** `[`[number](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number>)`, `[number](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number>)`]`

##### getMarkerSize

[Source for getMarkerSize](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L456-L473>)

```
getMarkerSize(feature: Feature<Geometry, { [x: string]: any; }>): [number, number]
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [feature](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L456-L456>) | `Feature<Geometry, { [x: string]: any; }>` |  |  |

**Returns:** `[`[number](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number>)`, `[number](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number>)`]`

##### labelLayer

[Source for labelLayer](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L265-L291>)

```
labelLayer(features: Feature<Geometry, { [x: string]: any; }>[], multiWorld: boolean, maxLabelLength: number, maxLines: number, clusterLayer?: Layer<Source, default<any>, { [x: string]: any; }> | undefined): VectorLayer<VectorSource<Feature<Geometry, { [x: string]: any; }>>, Feature<Geometry, { [x: string]: any; }>>
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [features](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L266-L266>) | `Feature<Geometry, { [x: string]: any; }>[]` |  |  |
| [multiWorld](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L267-L267>) | `boolean` |  |  |
| [maxLabelLength](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L268-L268>) | `number` |  |  |
| [maxLines](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L269-L269>) | `number` |  |  |
| [clusterLayer](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L270-L270>) (optional) | `Layer<Source, default<any>, { [x: string]: any; }> \| undefined` |  |  |

**Returns:** [VectorLayer](<https://openlayers.org/>)`<`[VectorSource](<https://openlayers.org/>)`<`[Feature](<https://openlayers.org/>)`<`[Geometry](<https://openlayers.org/>)`, { [x: `[string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)`]: `[any](<https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any>)`; }>>, `[Feature](<https://openlayers.org/>)`<`[Geometry](<https://openlayers.org/>)`, { [x: `[string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)`]: `[any](<https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any>)`; }>>`

##### resetCaches

[Source for resetCaches](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L59-L65>)

```
resetCaches(): void
```

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

##### setTheme

[Source for setTheme](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L180-L184>)

```
setTheme(groupColors: Record<number, string> | ColorPalette | undefined): void
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [groupColors](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L180-L180>) | `Record<number, string> \| ColorPalette \| undefined` |  |  |

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

##### setZoomCallback

[Source for setZoomCallback](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L176-L178>)

```
setZoomCallback(callback?: (() => number | undefined)): void
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [callback](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L176-L176>) (optional) | `(() => number \| undefined)` |  |  |

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

##### theme

[Source for theme](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L186-L189>)

**Modifiers:** readonly

**Type:** `{ fillColor: string; strokeColor: string; textColor: string; defaultMarkerColor: string; status: Record<MarkerStatusType, string>; colorPalette: ColorPalettes; }`

##### vectorLayer

[Source for vectorLayer](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L247-L263>)

Create vector layer when clustering is disabled

```
vectorLayer(features: Feature<Geometry, { [x: string]: any; }>[], multiWorld: boolean, defaultStyle?: boolean = false): VectorLayer<VectorSource<Feature<Geometry, { [x: string]: any; }>>, Feature<Geometry, { [x: string]: any; }>>
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [features](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L248-L248>) | `Feature<Geometry, { [x: string]: any; }>[]` |  | • list of Features |
| [multiWorld](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L249-L249>) | `boolean` |  | • boolean if points should be repeated on multiple world maps |
| [defaultStyle](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/services/map.service.ts#L250-L250>) (optional) | `boolean` | `false` |  |

**Returns:** [VectorLayer](<https://openlayers.org/>)`<`[VectorSource](<https://openlayers.org/>)`<`[Feature](<https://openlayers.org/>)`<`[Geometry](<https://openlayers.org/>)`, { [x: `[string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)`]: `[any](<https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any>)`; }>>, `[Feature](<https://openlayers.org/>)`<`[Geometry](<https://openlayers.org/>)`, { [x: `[string](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String>)`]: `[any](<https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#any>)`; }>>`

### Types Documentation

### [ColorPalette](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/color-palette.type.ts#L6-L6>)

**Kind:** type alias

```
import type { ColorPalette } from '@siemens/maps-ng';
```

```
type ColorPalette = 'status' | 'element'
```

### [ColorPalettes](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/color-palette.type.ts#L8-L10>)

**Kind:** type alias

```
import type { ColorPalettes } from '@siemens/maps-ng';
```

```
type ColorPalettes = {
  [key in ColorPalette]: string[];
}
```

### [MapPoint](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L6-L15>)

**Kind:** interface

```
import type { MapPoint } from '@siemens/maps-ng';
```

```
interface MapPoint extends MapPointMetaData
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [description](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L25-L25>) (inherited) | `string` | Marker description, can be simple string or HTML as string<br><br>Inherited from [MapPointMetaData](<index.html#t:MapPointMetaData>) |
| [extraProperties](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L33-L33>) (optional, inherited) | `any` | Extra properties to be passed along (click function consumes it)<br><br>Inherited from [MapPointMetaData](<index.html#t:MapPointMetaData>) |
| [group](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L38-L38>) (optional, inherited) | `number` | If you want your point to be clustered by it's group, you need to set the group id here for this point Color with the same id will be assigned. Must be higher than 0<br><br>Inherited from [MapPointMetaData](<index.html#t:MapPointMetaData>) |
| [lat](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L10-L10>) | `number` | Latitude value for marker |
| [lon](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L14-L14>) | `number` | Longitude value for marker |
| [marker](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L29-L29>) (optional, inherited) | `MarkerOptions` | Marker style<br><br>Inherited from [MapPointMetaData](<index.html#t:MapPointMetaData>) |
| [name](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L21-L21>) (inherited) | `string` | Marker name<br><br>Inherited from [MapPointMetaData](<index.html#t:MapPointMetaData>) |

#### Methods

##### click

[Source for click](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L42-L42>)

**Modifiers:** optional, inherited

Click functionality, do any extra staff when clicking on the point, just create needed logic for click functionality

Inherited from [MapPointMetaData](<index.html#t:MapPointMetaData>)

```
click(extraProperties?: any): void
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [extraProperties](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L42-L42>) (optional) | `any` |  |  |

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

### [MarkerStatusType](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L47-L48>)

**Kind:** type alias

```
import type { MarkerStatusType } from '@siemens/maps-ng';
```

```
type MarkerStatusType = 'success' | 'info' | 'warning' | 'danger' | 'caution' | 'critical' | 'default' | 'unknown'
```

### [MarkerOptions](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L57-L75>)

**Kind:** interface

```
import type { MarkerOptions } from '@siemens/maps-ng';
```

```
interface MarkerOptions
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [color](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L66-L66>) (optional) | `string` | Color of the marker, HEX or css compliant color value. Only use when a semantic status isn't working for the use-case. |
| [icon](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L74-L74>) (optional) | `IconMarkerOptions` | Icon options |
| [status](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L70-L70>) (optional) | `MarkerStatusType` | Semantic status for coloring. This is also theme-aware. |
| [type](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L61-L61>) | `"status" \| "icon" \| "dot"` | Visual representation of marker |

### [MapPointMetaData](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L17-L43>)

**Kind:** interface

```
import type { MapPointMetaData } from '@siemens/maps-ng';
```

```
interface MapPointMetaData
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [description](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L25-L25>) | `string` | Marker description, can be simple string or HTML as string |
| [extraProperties](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L33-L33>) (optional) | `any` | Extra properties to be passed along (click function consumes it) |
| [group](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L38-L38>) (optional) | `number` | If you want your point to be clustered by it's group, you need to set the group id here for this point Color with the same id will be assigned. Must be higher than 0 |
| [marker](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L29-L29>) (optional) | `MarkerOptions` | Marker style |
| [name](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L21-L21>) | `string` | Marker name |

#### Methods

##### click

[Source for click](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L42-L42>)

**Modifiers:** optional

Click functionality, do any extra staff when clicking on the point, just create needed logic for click functionality

```
click(extraProperties?: any): void
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [extraProperties](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L42-L42>) (optional) | `any` |  |  |

**Returns:** [void](<https://www.typescriptlang.org/docs/handbook/2/functions.html#void>)

### [IconMarkerOptions](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L77-L86>)

**Kind:** interface

```
import type { IconMarkerOptions } from '@siemens/maps-ng';
```

```
interface IconMarkerOptions
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [scale](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L85-L85>) (optional) | `number` | Scale value for marker |
| [src](<https://github.com/siemens/element/blob/main/projects/maps-ng/src/components/si-map/models/map-point.interface.ts#L81-L81>) (optional) | `string` | Path to the icon image |
