This topic describes the ST_GeometryType function. This function returns the type of the input geometry object.

Syntax

text  ST_GeometryType(geometry  g1);

Parameters

Parameter Description
g1 The geometry object that you want to specify.

Description

  • This function returns the type of the input geometry object as a string, such as ST_Linestring, ST_Polygon, or ST_MultiPolygon.
  • This function is different from the GeometryType function. The ST_GeometryType function does not indicate whether the input geometry object contains m coordinates.
  • This function supports 3D objects and does not delete z coordinates.
  • This function supports polyhedral surfaces.

Examples

  • Results returned by using the default parameter settings:
    SELECT ST_GeometryType('POINT(1 0)'::geometry);
     st_geometrytype
    -----------------
     ST_Point
    (1 row)
                        
  • Results returned by specifying a geometry object that contains m coordinates:
    SELECT ST_GeometryType('POINTM(1 0 1)'::geometry);
     st_geometrytype
    -----------------
     ST_Point
    (1 row)