---
title: "GeoJSONSourceSpecification | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

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

type GeoJSONSourceSpecification \= {  
    [attribution](#attribution)?: string;  
    [buffer](#buffer)?: number;  
    [cluster](#cluster)?: boolean;  
    [clusterMaxZoom](#clustermaxzoom)?: number;  
    [clusterMinPoints](#clusterminpoints)?: number;  
    [clusterProperties](#clusterproperties)?: unknown;  
    [clusterRadius](#clusterradius)?: number;  
    [data](#data): [GeoJSON](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.GeoJSON/) | string;  
    [filter](#filter)?: [FilterSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/FilterSpecification/);  
    [generateId](#generateid)?: boolean;  
    [lineMetrics](#linemetrics)?: boolean;  
    [maxzoom](#maxzoom)?: number;  
    [promoteId](#promoteid)?: [PromoteIdSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/PromoteIdSpecification/);  
    [tolerance](#tolerance)?: number;  
    [type](#type): "geojson";  
}

##### Index

### Properties[](#properties)

[attribution?](#attribution) [buffer?](#buffer) [cluster?](#cluster) [clusterMaxZoom?](#clustermaxzoom) [clusterMinPoints?](#clusterminpoints) [clusterProperties?](#clusterproperties) [clusterRadius?](#clusterradius) [data](#data) [filter?](#filter) [generateId?](#generateid) [lineMetrics?](#linemetrics) [maxzoom?](#maxzoom) [promoteId?](#promoteid) [tolerance?](#tolerance) [type](#type)

## Properties[](#properties-1)

### `Optional`attribution[](#attribution)

attribution?: string

Contains an attribution to be displayed when the map is shown to a user.

### `Optional`buffer[](#buffer)

buffer?: number

Size of the tile buffer on each side. A value of 0 produces no buffer. A value of 512 produces a buffer as wide as the tile itself. Larger values produce fewer rendering artifacts near tile edges and slower performance.

#### Default[](#default)

```typescript
128
```

### `Optional`cluster[](#cluster)

cluster?: boolean

If the data is a collection of point features, setting this to true clusters the points by radius into groups. Cluster groups become new `Point` features in the source with additional properties:

-   `cluster` Is `true` if the point is a cluster
    
-   `cluster_id` A unique id for the cluster to be used in conjunction with the [cluster inspection methods](https://maplibre.org/maplibre-gl-js/docs/API/classes/GeoJSONSource/#getclusterexpansionzoom)
    
-   `point_count` Number of original points grouped into this cluster
    
-   `point_count_abbreviated` An abbreviated point count
    

### `Optional`clusterMaxZoom[](#clustermaxzoom)

clusterMaxZoom?: number

Max zoom on which to cluster points if clustering is enabled. Defaults to one zoom less than maxzoom (so that last zoom features are not clustered). Clusters are re-evaluated at integer zoom levels so setting clusterMaxZoom to 14 means the clusters will be displayed until z15.

### `Optional`clusterMinPoints[](#clusterminpoints)

clusterMinPoints?: number

Minimum number of points necessary to form a cluster if clustering is enabled. Defaults to `2`.

### `Optional`clusterProperties[](#clusterproperties)

clusterProperties?: unknown

An object defining custom properties on the generated clusters if clustering is enabled, aggregating values from clustered points. Has the form `{"property_name": [operator, map_expression]}`. `operator` is any expression function that accepts at least 2 operands (e.g. `"+"` or `"max"`) - it accumulates the property value from clusters/points the cluster contains; `map_expression` produces the value of a single point.

Example: `{"sum": ["+", ["get", "scalerank"]]}`.

For more advanced use cases, in place of `operator`, you can use a custom reduce expression that references a special `["accumulated"]` value, e.g.:

`{"sum": [["+", ["accumulated"], ["get", "sum"]], ["get", "scalerank"]]}`

### `Optional`clusterRadius[](#clusterradius)

clusterRadius?: number

Radius of each cluster if clustering is enabled. A value of 512 indicates a radius equal to the width of a tile.

#### Default[](#default-1)

```typescript
50
```

### data[](#data)

data: [GeoJSON](https://docs.maptiler.com/sdk-js/api-reference/types/Externals.GeoJSON/) | string

A URL to a GeoJSON file, or inline GeoJSON.

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

filter?: [FilterSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/FilterSpecification/)

An expression for filtering features prior to processing them for rendering.

### `Optional`generateId[](#generateid)

generateId?: boolean

Whether to generate ids for the geojson features. When enabled, the `feature.id` property will be auto assigned based on its index in the `features` array, over-writing any previous values.

### `Optional`lineMetrics[](#linemetrics)

lineMetrics?: boolean

Whether to calculate line distance metrics. This is required for line layers that specify `line-gradient` values.

### `Optional`maxzoom[](#maxzoom)

maxzoom?: number

Maximum zoom level at which to create vector tiles (higher means greater detail at high zoom levels).

#### Default[](#default-2)

```typescript
18
```

### `Optional`promoteId[](#promoteid)

promoteId?: [PromoteIdSpecification](https://docs.maptiler.com/sdk-js/api-reference/types/PromoteIdSpecification/)

A property to use as a feature id (for feature state). Either a property name, or an object of the form `{<sourceLayer>: <propertyName>}`.

### `Optional`tolerance[](#tolerance)

tolerance?: number

Douglas-Peucker simplification tolerance (higher means simpler geometries and faster performance).

#### Default[](#default-3)

```typescript
0.375
```

### type[](#type)

type: "geojson"

The data type of the GeoJSON source.
