All Products
Search
Document Center

ApsaraDB RDS:ST_AsBox3D

Last Updated:Mar 28, 2026

Returns the box3d-type spatial range of a 3D geographic grid object. Use the array overload to process multiple grid cells in a single call.

Syntax

box ST_AsBox3D(geomgrid grid);
box[] ST_AsBox3D(geomgrid[] grid);

Parameters

ParameterDescription
gridThe geographic grid object to convert.

Description

This function returns the box3d-type spatial range of a 3D geographic grid.

Examples

Example 1: Single grid cell from a point

SELECT ST_AsBox3D(unnest(ST_As3DGrid(
  'srid=4490;POINT(116.31522216796875 39.910277777777778 1001.8)'::geometry, 20)));

Output:

                                   st_asbox3d
--------------------------------------------------------------------------------
 BOX3D(116.315 39.91 970.027683307417,116.315555555556 39.9105555555556 1023.92243561707)

Example 2: Array of grid cells from a line

SELECT ST_AsBox3D(ST_As3DGrid(
'srid=4490;LINESTRING Z (116 39 2000,116.012 39.009 3000)'::geometry, 10));

Output:

{"BOX3D(115.533333333333 38.5333333333333 0,116 39 55418.9804682462)","BOX3D(115.533333333333 39 0,116 39.5333333333333 55418.9804682462)",
 "BOX3D(116 38.5333333333333 0,116.533333333333 39 55418.9804682462)","BOX3D(116 39 0,116.533333333333 39.5333333333333 55418.9804682462)"}