The ST_TileEnvelope scalar function generates tile envelope rectangular polygons from specified zoom level and tile indices.
This is used in MVT generation to select the features corresponding to the tile extent. The envelope is in the Web Mercator
coordinate reference system (EPSG:3857). The tile pyramid starts at zoom level 0, corresponding to a single tile for the
world. Each zoom level doubles the number of tiles in each direction, such that zoom level 1 is 2 tiles wide by 2 tiles high,
zoom level 2 is 4 tiles wide by 4 tiles high, and so on. Tile indices start at [x=0, y=0] at the top left, and increase
down and right. For example, at zoom level 2, the top right tile is [x=3, y=0], the bottom left tile is [x=0, y=3], and
the bottom right is [x=3, y=3].
SQL examples
SELECT ST_TileEnvelope(2, 3, 1);
-- +-----------------------------------------------------------------------------------------------------------+
-- | st_tileenvelope(2, 3, 1) |
-- | geometry |
-- +-----------------------------------------------------------------------------------------------------------+
-- | POLYGON ((1.00188E+07 0, 1.00188E+07 1.00188E+07, 2.00375E+07 1.00188E+07, 2.00375E+07 0, 1.00188E+07 0)) |
-- +-----------------------------------------------------------------------------------------------------------+