All Products
Search
Document Center

PolarDB:ST_Tile

Last Updated:Mar 28, 2026

Queries a tile from a named pyramid and returns it as a Mapbox Vector Tile (MVT) binary.

Syntax

bytea ST_Tile(cstring name, cstring key);
bytea ST_Tile(cstring name, int x, int y, int z);

Parameters

ParameterTypeDescription
namecstringThe name of the pyramid.
keycstringThe tile ID in z_x_y format (e.g., 3_1_6).
xintThe x value in the tile ID.
yintThe y value in the tile ID.
zintThe z value in the tile ID.

Description

ST_Tile queries a tile from a pyramid and returns it as a bytea value in MVT format. The two syntax forms are equivalent: pass the tile ID either as a z_x_y string or as three separate integers.

Tile IDs follow the z_x_y scheme, where z is the zoom level and x/y identify the tile's column and row within the grid at that zoom level. The pyramid must be built on either the EPSG:4326 (WGS 84) or EPSG:3857 (Web Mercator) coordinate system.

Important

When using EPSG:4326, the tile grid has twice as many columns as rows at every zoom level. The zoom level starts at 1, so at z=1 the only valid tile IDs are 1_0_0 and 1_1_0.

Examples

Both calls below query the same tile from the roads pyramid and return identical output.

-- Using a key string
SELECT ST_Tile('roads', '3_1_6');
-- Using separate x, y, z integers
SELECT ST_Tile('roads', 1, 6, 3);

Output:

st_tile
----------
0xFFAABB8D8A6678...

What's next

  • Create a pyramid with the pyramid creation functions before calling ST_Tile.