ST_AsGeometry

Updated at:

Converts various data types to Geometry.

Syntax

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

Parameters

Parameter name

Description

geom

The meshgeom object.

sfmeshObject

The 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_AsText(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}]}'::sfmesh)));
------------------------------------------------------------------------------
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)))