Decomposes a coarse-grained geographic grid 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
| Parameter | Applicable syntax | Description |
|---|---|---|
gridcode | First syntax | A single geographic grid object. |
gridarray | Second syntax | An array of geographic grid objects. |
precision | Both | The decomposition level. |
Description
ST_Degeneralize breaks a coarse-grained geographic grid (or an array of grids) into all the finer-grained child grids at the target precision level.
Examples
Example: Decompose a single grid
The following example decomposes grid G01 into child grids at precision level 3.
SELECT ST_AsText(ST_Degeneralize(ST_GridFromText('G01'), 3));Output:
{G010,G011,G012,G013}Example: Decompose a grid array
The following example decomposes an array of two grids (GZ01 and GZ1) into child grids at precision level 2. The result is a flat array of all child grids from both inputs at that level.
SELECT ST_AsText(ST_Degeneralize(ARRAY[ST_GridFromText('GZ01'), ST_GridFromText('GZ1')], 2));Output:
{GZ01,GZ10,GZ12,GZ14,GZ16,GZ11,GZ13,GZ15,GZ17}