---
title: "MarkerLayoutOptions | Marker layout | JavaScript maps SDK"
description: "Documentation for Marker layout"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Type Alias MarkerLayoutOptions

type MarkerLayoutOptions \= {  
    [filter](#filter)?: (feature: MapGeoJSONFeature) \=> boolean;  
    [groupBy](#groupby)?: string;  
    [layers](#layers)?: string\[\];  
    [markerAnchor](#markeranchor)?: [MarkerAnchor](https://docs.maptiler.com/sdk-js/modules/marker-layout/api/types/MarkerAnchor/);  
    [markerSize](#markersize)?: \[number, number\];  
    [max](#max)?: number;  
    [maxNbFeaturesPerMarker](#maxnbfeaturespermarker)?: number;  
    [maxRatioUnitSize](#maxratiounitsize)?: number;  
    [offset](#offset)?: \[number, number\];  
    [sortingOrder](#sortingorder)?: "ascending" | "descending";  
    [sortingProperty](#sortingproperty)?: string | ((feature: MapGeoJSONFeature) \=> number);  
}

-   Defined in [markerlayout.ts:67](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L67)

##### Index

### Properties

[filter?](#filter) [groupBy?](#groupby) [layers?](#layers) [markerAnchor?](#markeranchor) [markerSize?](#markersize) [max?](#max) [maxNbFeaturesPerMarker?](#maxnbfeaturespermarker) [maxRatioUnitSize?](#maxratiounitsize) [offset?](#offset) [sortingOrder?](#sortingorder) [sortingProperty?](#sortingproperty)

## Properties

### `Optional`filter[](#filter)

filter?: (feature: MapGeoJSONFeature) \=> boolean

A filter function can be provided. Each feature will be tested against this filter function, and the returned value can be `true` (the feature is kept) or `false` (the feature is discarded). Default: none

-   Defined in [markerlayout.ts:107](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L107)

### `Optional`groupBy[](#groupby)

groupBy?: string

Property to group by. The property must be present in the `properties` object of the feature unless the value of `groupBy` is equal to `"coordinates"`, then the geometry coordinates are being used. Default: no grouping

-   Defined in [markerlayout.ts:129](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L129)

### `Optional`layers[](#layers)

layers?: string\[\]

IDs of layers to query for vector features. Default: uses all the layers available

-   Defined in [markerlayout.ts:72](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L72)

### `Optional`markerAnchor[](#markeranchor)

markerAnchor?: [MarkerAnchor](https://docs.maptiler.com/sdk-js/modules/marker-layout/api/types/MarkerAnchor/)

Position of the marker relative to its anchor point. Default: `"center"`

-   Defined in [markerlayout.ts:90](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L90)

### `Optional`markerSize[](#markersize)

markerSize?: \[number, number\]

Size of the markers on screen space \[width, height\]. Default: `[150, 50]`

-   Defined in [markerlayout.ts:78](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L78)

### `Optional`max[](#max)

max?: number

Maximum number of markers to keep. Default: no maximum

-   Defined in [markerlayout.ts:84](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L84)

### `Optional`maxNbFeaturesPerMarker[](#maxnbfeaturespermarker)

maxNbFeaturesPerMarker?: number

Markers can contain multiple features, this parameter can be set to have a strict limit. Default: `Infinity`

-   Defined in [markerlayout.ts:135](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L135)

### `Optional`maxRatioUnitSize[](#maxratiounitsize)

maxRatioUnitSize?: number

When a marker contains multiple features, its size can get bigger. This number is the max ratio applied to the defined `markerSize`. Intentionnaly non-integer so that the user can see there is still half an element to show at the bottom and undestand they can scroll for more. Default: `2.5`

-   Defined in [markerlayout.ts:143](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L143)

### `Optional`offset[](#offset)

offset?: \[number, number\]

Offset to apply to the marker, in number of pixel, relative to its anchor position. First element of the array is the horizontal offset where negative shifts towards the left and positive shifts towards the right. Second element of the array is the vertical offset where negative shifts towards the top and positive shifts towards the bottom. Default: `[0, 0]`

-   Defined in [markerlayout.ts:100](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L100)

### `Optional`sortingOrder[](#sortingorder)

sortingOrder?: "ascending" | "descending"

Sorting order, only relevant if the option `.sortingProperty` is provided, or else will be ignored. Default: `"ascending"`

-   Defined in [markerlayout.ts:121](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L121)

### `Optional`sortingProperty[](#sortingproperty)

sortingProperty?: string | ((feature: MapGeoJSONFeature) \=> number)

Property to sort the features by. If not provided, the features will not be sorted. Alternatively, the sorting property can be a function that takes the feature as argument and returns a number, aka. the sorting value (or rank) Default: not provided

-   Defined in [markerlayout.ts:115](https://github.com/maptiler/maptiler-marker-layout/blob/c2121d13d89fb5e807a51caa949591fc11ba8a26/src/markerlayout.ts#L115)
