# Vector Tile Cache

Vector tiles are a highly efficient format for web mapping. The core concept is to divide a project's vector data into tiles, similarly to raster tile systems (such as WMTS).

There are several standards for producing vector tiles. [Mapbox](https://docs.mapbox.com/#maps) introduced a format based on Google's Protocol Buffers encoding (<https://developers.google.com/protocol-buffers>). Known as MVT (Mapbox Vector Tiles), this format is widely supported by many platforms, including JMap Cloud, JMap Server, and JMap NG.

A tiling grid is applied to vector data, dividing it into tiles. Each tile can contain features from multiple layers. A set of tiles is generated for each zoom level. In web mapping, there are typically 23 zoom levels:

* Level 0: global scale
* Level 22: street-level scale

Geometries are generalized at lower zoom levels to optimize performance while maintaining acceptable visual quality.

Geometries (lines, polygons) are clipped at tile boundaries. When a geometry spans multiple tiles, it is split, and each tile contains only the corresponding portion. The mapping application reconstructs the complete feature.

Feature attributes are included in the tiles, making the data interactive and dynamic. This enables, for example:

* generating thematic maps on the fly,
* applying attribute-based filters.

Styles are not included within the tiles. They are defined in a separate JSON file. This approach allows styles to be dynamically modified in applications without needing to regenerate the tiles. Only the applications handle the interpretation and rendering of styles.

Vector tiles can be generated on demand or generated in advance and then cached, enabling fast server response times and a smooth user experience.

## Vector Tile Generation in JMap Cloud

A JMap Cloud project generates three types of data consumed by JMap NG applications:

**Style JSON File**

This file accompanies the tiles and contains layer definitions, styles, etc.

**Vector Tile Set (MVT)**

These tiles contain the geometries and attributes of non-editable layers. They can be generated:

* on demand, as the user navigates in JMap NG,
* or in advance, then cached.

**GeoJSON Vector Data**

These correspond to editable layers and are delivered on demand, by region.

## Factors Affecting Vector Tile Performance

Although generally lighter than raster tiles, several variables can affect tile size and, consequently, the performance of JMap NG applications:

* **Number of attributes per layer**: the more attributes a layer contains, the larger the tiles.
* **Visibility scales**: it is recommended to define visibility thresholds for dense layers. Restricting their display to large scales reduces tile volume at small scales and improves load times.
* **Caching**: pre-generating and caching tiles significantly increases application performance.
* **Layer generalization level**: this parameter, accessible in Studio, reduces tile volume by simplifying the display of features at small scales.

## Managing a Project's Vector Tile Cache

{% hint style="info" %}
Cache generation can take considerable time and storage space. **It is not recommended to cache tiles beyond level 19.**
{% endhint %}

To manage a project's vector tile cache, click the menu icon and select **Vector tile cache**. The interface contains two tabs: **New task** and **Cache status**.

#### **Cache Status tab**

This tab displays:

* A table indicating the number of cached tiles for each of the 23 levels.
* The total number of cached tiles.
* The cache volume.

#### **New Task tab**

This interface allows you to configure a task to create or delete the vector tile cache.

The parameters to configure are as follows:

**Task type**

Two types of tasks are available:

* **Fill cache**: This option lets you specify whether you want to create tiles for all 23 levels or for a specific range of levels. In the latter case, indicate the minimum and maximum levels of the range. This option does not replace tiles that are already cached.
* **Delete cache**: This option lets you specify whether you want to delete tiles for all 23 levels or for a specific range of levels. In the latter case, indicate the minimum and maximum levels of the range.

**Levels**

You can create or delete the cache for all levels or for a range of levels. In the second case, define the range by selecting the minimum and maximum levels.

**Task extent**

To define the geographic extent covered by the task, check the relevant box and set the extent using the green frame by moving the map. The project's initial view is displayed as a dotted frame.

**Running the task**

Once the parameters are defined, click **Launch task**. Progress is displayed graphically and as a percentage.

To cancel a running task, click **Cancel task**. A confirmation message will appear.

The **Cache Status** tab reflects the changes.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jmapcloud.io/en/jmap-cloud-portal/user-guide-for-jmap-cloud-portal/organizing-data-into-projects/managing-projects/vector-tile-cache.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
