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

Syntax

bytea ST_AsBinary(geomgrid    grid)

Parameters

Parameter Description
grid The grid that you want to convert.

Examples

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