Name

ST_GeometryType — Returns the SQL-MM type of a geometry as text.

Synopsis

text ST_GeometryType(geometry g1);

Description

Returns the type of the geometry as a string. EG: 'ST_LineString', 'ST_Polygon','ST_MultiPolygon' etc. This function differs from GeometryType(geometry) in the case of the string and ST in front that is returned, as well as the fact that it will not indicate whether the geometry is measured.

Enhanced: 2.0.0 support for Polyhedral surfaces was introduced.

This method implements the SQL/MM specification. SQL-MM 3: 5.1.4

This function supports 3d and will not drop the z-index.

This function supports Polyhedral surfaces.

Examples

Code
SELECT ST_GeometryType('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'::geometry);
Output
ST_LineString
Code
SELECT ST_GeometryType('POLYHEDRALSURFACE( ((0 0 0,0 0 1,0 1 1,0 1 0,0 0 0)),
((0 0 0,0 1 0,1 1 0,1 0 0,0 0 0)),((0 0 0,1 0 0,1 0 1,0 0 1,0 0 0)),
((1 1 0,1 1 1,1 0 1,1 0 0,1 1 0)),
((0 1 0,0 1 1,1 1 1,1 1 0,0 1 0)),((0 0 1,1 0 1,1 1 1,0 1 1,0 0 1)) )'::geometry);
Output
ST_PolyhedralSurface
Code
SELECT ST_GeometryType(geom) AS result
FROM
  (SELECT
     'TIN (((
              0 0 0,
              0 0 1,
              0 1 0,
              0 0 0
          )),((
              0 0 0,
              0 1 0,
              1 1 0,
              0 0 0
          ))
          )'::geometry AS geom
  ) AS g;
Output
ST_Tin

See Also

GeometryType