All Products
Search
Document Center

ApsaraDB RDS:ST_Level

Last Updated:Sep 28, 2023

This topic describes the ST_Level function. This functions is used to obtain the gridding level of a geographic grid.

Syntax

integer ST_Level(geomgrid gridcode);
integer[] ST_Level(geomgrid[] gridcode);
integer ST_Level(h3grid gridcode);

Parameters

Parameter

Description

gridcode

The geographic grid object.

Description

This function is used to obtain the level of a geographic grid or an array of geographic grids. For an array of geographic grids, this function returns the level range.

Examples

select st_level(ST_GridFromText('GZ0026206440'));
 st_level 
----------
       10

select st_level(st_as3dgrid('srid=4490;GEOMETRYCOLLECTION Z (MULTIPOLYGON Z (((116 39 5000,116.12 39 5000,116.12 39.09 5000,116 39.09 5000,116 39 5000),
(116.024 39.018 5000,116.024 39.045 5000,116.06 39.045 5000,116.06 39.018 5000,116.024 39.018 5000))),
POINT Z (116 39 5000),MULTILINESTRING Z ((116 39 5000,116.024 39 5000),(116.012 39.009 5000,116.024 39.018 5000)),
POLYHEDRALSURFACE Z (((116 39 0,116 39 1000,116 39.009 0,116 39 0)),((116 39 0,116 39.009 0,116.012 39 0,116 39 0)),
((116 39 0,116.012 39 0,116 39 1000,116 39 0)),((116.012 39 0,116 39.009 0,116 39 1000,116.012 39 0))))'::geometry, 
20,true));
 st_level 
----------
 {19,20}

-- H3 encoding
select st_level(st_h3frombinary('\x010100ffff9f6826a18408'));
 st_level 
----------
        8