All Products
Search
Document Center

PolarDB:ST_GridLevelFromZ

Last Updated:Mar 28, 2026

Returns the grid level index along the vertical axis for a given altitude, within a geographic grid at the specified precision.

Syntax

bigint ST_GridLevelFromZ(float altitude, integer precision);

Parameters

ParameterTypeDescription
altitudefloatThe altitude, in meters.
precisionintegerThe precision level of the geographic grid. Valid values: 1–32 (inclusive).

Description

ST_GridLevelFromZ maps an altitude (in meters) to the corresponding grid level index in the vertical dimension of a GanosBase geographic grid. The returned bigint identifies the vertical position within the grid hierarchy at the given precision.

Example

The following example returns the vertical grid level for an altitude of 1005.8 meters at precision level 25.

SELECT ST_GridLevelFromZ(1005.8, 25);
 st_gridlevelfromz
-------------------
               597