This topic describes the ST_AsBinary function. This function returns the binary representation of an object of any type.

Syntax

bytea ST_AsBinary(meshgeom geom);
bytea ST_AsBinary(sfmesh sfmeshObject);
bytea ST_AsBinary(material material);
bytea ST_AsBinary(texture texture);
bytea ST_AsBinary(meshgeom geom, cstring endian);
bytea ST_AsBinary(sfmesh sfmeshObject, cstring endian);
bytea ST_AsBinary(material material, cstring endian);
bytea ST_AsBinary(texture texture, cstring endian);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshObjectThe sfmesh object.
materialThe material object.
textureThe texture object.
endianThe endian. Valid values:
  • NDR: little endian
  • XDR: big endian

Description

This function returns the binary representation of an object of any type. This function serves the same as the explicit type conversion ::bytea.

Examples

select ST_AsBinary(ST_MeshFromText('{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}'));

------------------------------------------------------------------------------
\x014d0102...