All Products
Search
Document Center

PolarDB:ST_Degeneralize

Last Updated:Mar 28, 2026

Decomposes a geographic grid or an array of geographic grids into an array of finer-grained child grids at a specified precision level.

Syntax

geomgrid[] ST_Degeneralize(geomgrid gridcode, integer precision);

geomgrid[] ST_Degeneralize(geomgrid[] gridarray, integer precision);

Return value

geomgrid[] — an array of geographic grids at the target precision level.

Parameters

ParameterDescription
gridcodeA single geographic grid object to decompose.
gridarrayAn array of geographic grid objects to decompose.
precisionThe target precision level for the output child grids.

Description

ST_Degeneralize traverses the geographic grid hierarchy downward: it takes a coarser-grained grid and returns all the finer-grained child grids that make it up. The result is a geomgrid[] array containing the child grids at the specified precision level.

To go in the opposite direction — aggregating finer-grained grids into a coarser parent grid — use ST_Generalize.

Examples

Decompose a single grid into child grids

The following example decomposes grid G01 into its child grids at precision level 3.

select st_astext(st_degeneralize(st_gridfromtext('G01'), 3));

Output:

{G010,G011,G012,G013}

Decompose an array of grids into child grids

The following example decomposes an array containing grids GZ01 and GZ1 into their combined child grids at precision level 2.

select st_astext(st_degeneralize(array[st_gridfromtext('GZ01'), st_gridfromtext('GZ1')], 2));

Output:

{GZ01,GZ10,GZ12,GZ14,GZ16,GZ11,GZ13,GZ15,GZ17}

What's next

  • ST_Generalize — aggregate finer-grained grids into a coarser parent grid