Skip to content

ST_GeometryType

Returns the type of a geometry or geography.

Usage

string ST_GeometryType(geom: geometry)
string ST_GeometryType(geog: geography)

Arguments

  • geog (geography): Input geography
  • geom (geometry): Input geometry

Description

Returns the OGC geometry type name prefixed with ST_. Possible return values include: 'ST_Point', 'ST_LineString', 'ST_Polygon', 'ST_MultiPoint', 'ST_MultiLineString', 'ST_MultiPolygon', and 'ST_GeometryCollection'.

Examples

SELECT ST_GeometryType(ST_GeomFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'));
┌─────────────────────────────────────────────────────────────────────────┐
 st_geometrytype(st_geomfromwkt(Utf8("POLYGON ((0 0, 1 0, 0 1, 0 0))"))) 
                                   utf8                                  
╞═════════════════════════════════════════════════════════════════════════╡
 ST_Polygon                                                              
└─────────────────────────────────────────────────────────────────────────┘
SELECT ST_GeometryType(ST_GeogFromWKT('POLYGON ((0 0, 1 0, 0 1, 0 0))'));
┌─────────────────────────────────────────────────────────────────────────┐
 st_geometrytype(st_geogfromwkt(Utf8("POLYGON ((0 0, 1 0, 0 1, 0 0))"))) 
                                   utf8                                  
╞═════════════════════════════════════════════════════════════════════════╡
 ST_Polygon                                                              
└─────────────────────────────────────────────────────────────────────────┘