All Products
Search
Document Center

PolarDB:ST_GridLevelFromZ

Last Updated:Mar 28, 2026

Returns the grid level of a geographic grid based on the given altitude and precision.

Syntax

bigint ST_GridLevelFromZ(float altitude, integer precision)

Parameters

ParameterDescription
altitudeThe altitude in meters.
precisionThe precision level of the geographic grid. Valid values: 1 to 32.

Description

ST_GridLevelFromZ computes the grid level corresponding to a given altitude at a specified precision level. The return value is a bigint representing the grid level index.

Examples

SELECT ST_GridLevelFromZ(1005.8, 25);

Output:

 st_gridlevelfromz
------------------
              597