Converts a meshgeom or sfmesh object into a standard geometry value.
Syntax
geometry ST_AsGeometry(meshgeom geom);
geometry ST_AsGeometry(sfmesh sfmeshObject);Parameters
| Parameter | Type | Description |
|---|---|---|
geom | meshgeom | The meshgeom object to convert. |
sfmeshObject | sfmesh | The sfmesh object to convert. |
Return value
Returns a geometry value of the collection type. The exact subtype is either GeomCollection or MultiPolygon.
Example
Convert a meshgeom object to a multipolygon geometry and return its WKT representation.
select ST_AsWKT(ST_AsGeometry(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}]}')));Expected output:
MULTIPOLYGON Z (((0 0 2,0 10 3,10 10 1,0 0 2)),((0 10 3,10 10 1,10 0 1,0 10 3)))See also
ST_MeshFromText— constructs ameshgeomobject from a text representation, used as input toST_AsGeometryST_AsWKT— converts ageometryvalue to its Well-Known Text (WKT) representation
该文章对您有帮助吗?