> For the complete documentation index, see [llms.txt](https://talque.gitbook.io/public/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://talque.gitbook.io/public/webhooks/map-features/map-layer.md).

# Map layer

This API lets you create or update map layers. This must be done before creating any map features that reference the layer.&#x20;

### Map layer data JSON

The defining data of the map layer is a json document consisting of the following data. Note that min/max bounds are provided in an *Interval* JSON document below of the form&#x20;

```json
{"min": 0, "max": 20}
```

The json document defining a map layer then contains the fields:

|                    |                 |                                    |
| ------------------ | --------------- | ---------------------------------- |
| `name`             | translated text | The name of the layer              |
| `coordinateSystem` | string          | Use `"EPSG_3857"`                  |
| `layerType`        | string          | Use `"TILE"`                       |
| `xBound`           | Interval        | Longitude bound                    |
| `yBound`           | Interval        | Latitude bound                     |
| `zoomBound`        | Interval        | E.g. `{"min": 0, "max": 20}`       |
| `extId`            | string \| null  | External ID of the map layer       |
| `mapLayerId`       | string          | Optional map layer id to overwrite |

## Create or update map layer

<mark style="color:green;">`POST`</mark> `https://www.talque.com/webhook/org/<org_id>/map/layer/create`

Creates or updates map layer. A valid map layer id must be supplied, typically you need one per exhibition hall of the venu. The layer ID can be reused for different org ids.

**Body**

| Name        | Type    | Description                                                  |
| ----------- | ------- | ------------------------------------------------------------ |
| `isPrimary` | string  | This map layer is the primary layer                          |
| `mapLayer`  | JSON    | [Map layer data](#map-layer-data-json)                       |
| `clearAll`  | boolean | Whether to delete all other map data, missing means `false`. |

**Response**

{% tabs %}
{% tab title="200" %}

```json
{
  "success": true,
  "isPrimary": "true",
  "mapLayer": { ... },
  "clearAll": false,
}
```

{% endtab %}

{% tab title="400" %}

```json
{
  "error": "Invalid request"
}
```

{% endtab %}
{% endtabs %}
