ST_AsEWKT

更新时间:
复制 MD 格式

Returns the Extended Well-Known Text (EWKT) representation of a meshgeom or sfmesh object.

Syntax

text ST_AsEWKT(meshgeom geom);
text ST_AsEWKT(sfmesh sfmeshObject);

Parameters

ParameterTypeDescription
geommeshgeomA meshgeom object.
sfmeshObjectsfmeshAn sfmesh object.

Examples

Convert an sfmesh object to EWKT

This example converts an sfmesh object constructed from a JSON mesh definition. The output is the JSON representation of the mesh, without an SRID prefix.

select ST_AsEWKT(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}]}'));

Output:

{"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}]}

Convert a meshgeom object to EWKT

This example converts a meshgeom object created with an explicit SRID of 4326. The output includes the SRID=4326; prefix.

select ST_AsEWKT(ST_MeshGeomFromText('MESHGEOM(PATCH(INDEXSURFACE(VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))', 4326));

Output:

SRID=4326;MESHGEOM(PATCH(INDEXSURFACE Z (VERTEX(0 0 2,0 10 3,10 10 1,10 0 1),INDEX((0,1,2),(1,2,3)))))

What's next

  • Use ST_MeshFromText to construct an sfmesh object from a JSON mesh definition.

  • Use ST_MeshGeomFromText to construct a meshgeom object with an explicit SRID.