ST_MeshFromText

更新时间:
复制 MD 格式

Constructs an sfmesh object from the well-known text (WKT) representation of an sfmesh.

Syntax

sfmesh ST_MeshFromText(text wkt);
sfmesh ST_MeshFromText(text wkt, int4 srid);

Parameters

ParameterTypeDescription
wkttextThe sfmesh object in WKT representation.
sridint4The spatial reference identifier (SRID) to embed in the returned sfmesh.

Return type

sfmesh

Usage notes

  • Without `srid`: Returns an sfmesh with no embedded spatial reference identifier.

  • With `srid`: Embeds the specified SRID in the returned sfmesh as part of its metadata.

Examples

The following example constructs an sfmesh from a WKT string with SRID 4490 and returns it in EWKT format.

SELECT ST_AsEWKT(ST_MeshFromText('{"version" : 1, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(TRIANGLESTRIP(0 0,0 10,10 10,10 0)))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}', 4490));

Expected output:

{"version" : 1, "srid" : 4490, "root" : 0, "meshgeoms" : ["MESHGEOM(PATCH(TRIANGLESTRIP(0 0,0 10,10 10,10 0)))"], "primitives" : [{"meshgeom" : 0}], "nodes" : [{"primitive" : 0}]}

Notice that srid appears in the output when specified. Omit the second argument to construct an sfmesh without an embedded SRID.