All Products
Search
Document Center

PolarDB:ST_AsBinary

Last Updated:Oct 19, 2023

This topic describes the ST_AsBinary function. This function converts a grid into a binary structure.

Syntax

bytea ST_AsBinary(geomgrid    grid)
bytea ST_AsBinary(h3grid    grid)

Parameters

Parameter

Description

grid

The grid object that you want to obtain. The data type is GeomGrid or H3Grid.

Examples

with g as (
select unnest(st_asgrid(
    ST_geomfromtext('POINT(116.31522216796875 39.910277777777778)',4490), 15)) as grid) 
select ST_asBinary(grid) from g; 
   
   st_asbinary     
--------------------
 \x0102000f74271236

select st_asbinary(unnest(st_as3dgrid(
  'srid=4490;POINT(116.31522216796875 39.910277777777778 1001.8)'::geometry, 20)));
          st_asbinary           
--------------------------------
 \x0102401474271236362412000000
 
-- H3Grid
select st_asbinary(st_h3fromlatlng(20.5,128.2,8));
       st_asbinary        
--------------------------
 \x010100ffff9f6826a18408