All Products
Search
Document Center

ApsaraDB RDS:ST_AsMVTGeomEx

Last Updated:Sep 28, 2023

The topic describes the ST_AsMVTGeomEx function. This function serves the same as the ST_AsMVTGeom function. The ST_AsMVTGeomEx function supports the res_rec parameter. The parameter filters out vectors that have little impact on the display effect. This offloads the frontend and backend, reduces network overheads, and improves visualization efficiency.

Syntax

GEOMETRY ST_AsMVTGeomEx(
	GEOMETRY geom,
	BOX2D bounds, 
	INTEGER res_prec=1, 
	INTEGER extent=4096, 
	INTEGER buffer=256, 
	BOOLEAN clip_geom=true
);

Parameters

Parameter

Description

geom

The geometry object that you want to convert.

bounds

The rectangular boundaries of the tile, excluding the buffer.

res_prec

Specifies the filtering scope. In a tile, if the maximum number of pixels displayed in the x-axis or y-axis for a geometry object is less than the value of this parameter, the geometry object is filtered out.

extent

The size of the tile in the tile coordinate system. Default value: 4096.

buffer

The size of the buffer in the tile coordinate system. Default value: 256.

clip_geom

Specifies whether the geometry object is clipped by tile boundaries. Default value: true.

Description

  • The ST_AsMVTGeomEx function serves the same as the ST_AsMVTGeom function. The ST_AsMVTGeomEx function supports the res_rec parameter to improve visualization efficiency.

  • For small-sized tiles, if you set the res_rec parameter to a large value, a large number of vectors may be invisible.

  • This function is not suitable for the visualization of point data.

  • This function is suitable for the visualization of vector data of different sizes.

Examples

-- Only the vectors with a minimum of two pixels in the x-axis or y-axis of the current tile are visualized.
WITH mvtgeom AS(SELECT ST_AsMVTGeomEx(geom, ST_Transform(ST_TileEnvelope(0,0,0),4326),2)AS geom
FROM geom_table
WHERE geom && ST_Transform(ST_TileEnvelope(0,0,0),4326))
SELECT ST_AsMVT(mvtgeom.*);