All Products
Search
Document Center

AnalyticDB:ST_AsBinary

Last Updated:Mar 28, 2026

Converts a geomgrid object to a binary structure as a bytea value.

Syntax

bytea ST_AsBinary(geomgrid grid)

Parameters

ParameterDescription
gridThe geomgrid object to convert.

Example

The following example generates a level-15 grid from a point geometry and converts it to binary.

WITH g AS (
  SELECT unnest(ST_AsGridCode(
    ST_GeomFromText('POINT(116.31522216796875 39.910277777777778)', 4490), 15)) AS grid
)
SELECT ST_AsBinary(grid) FROM g;

Output:

   st_asbinary
--------------------
 \x01010c0f74271236