This topic describes the ST_AsGeometry function. This function constructs a geometry from an object of any type.

Syntax

geometry ST_AsGeometry(meshgeom geom);
geometry ST_AsGeometry(sfmesh sfmeshObject);

Parameters

ParameterDescription
geomThe meshgeom object.
sfmeshObjectThe sfmesh object.

Description

This function constructs a geometry from an object of any type. The type of the geometry is a collection type, which can be GeomCollection or MultiPolygon.

Examples

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

------------------------------------------------------------------------------
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)))