ST_MeshGeomFromBinary

更新时间:
复制 MD 格式

ST_MeshGeomFromBinary constructs a meshgeom object from its well-known binary (WKB) representation.

Syntax

meshgeom ST_MeshGeomFromBinary(bytea wkb);
meshgeom ST_MeshGeomFromBinary(bytea wkb, int4 srid);

Parameters

ParameterDescription
wktThe WKB representation of the meshgeom object.
sridThe spatial reference identifier (SRID).

Example

The following example converts a meshgeom object to WKB using ST_AsBinary, reconstructs it with ST_MeshGeomFromBinary, and returns the result in EWKT format.

SELECT ST_AsEWKT(
  ST_MeshGeomFromBinary(
    ST_AsBinary(
      'MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1), INDEX((0,1,2),(1,2,3)))))'::meshgeom
    )
  )
);

Output:

MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))

Related topics

  • ST_AsBinary: serializes a meshgeom object to WKB.

  • ST_AsEWKT: serializes a meshgeom object to well-known text (WKT) or EWKT.