ST_GEOMETRYTYPE()

All functions > GEOSPATIAL > ST_GEOMETRYTYPE()

Returns the OGC type name of a geometry or geography as a string.

Signatures

Geometry type

Returns: OGC-style type label as a string (e.g. DuckDB: POINT, POLYGON; other engines may use ST_Point, ST_Polygon, …)

ST_GEOMETRYTYPE(geo: T) → VARCHAR
sql
ParameterTypeRequiredDescription
geoTYesGeometry or geography value

With:

  • T : Custom types: GEOM_POINT | GEOM_LINESTRING | GEOM_POLYGON | GEOM_MULTIPOINT | GEOM_MULTILINESTRING | GEOM_MULTIPOLYGON | GEOM_MULTIANY | GEOG_POINT | GEOG_LINESTRING | GEOG_POLYGON | GEOG_MULTIPOINT | GEOG_MULTILINESTRING | GEOG_MULTIPOLYGON | GEOG_MULTIANY

Signature notes:

  • Return value format varies by engine (DuckDB spatial uses plain POINT, POLYGON, …; others may prefix with ST_)
  • Returns NULL if the input is NULL

Availability

Available on DuckDB, Trino. Not available on Serving.

Examples

FeatureQL
RETURN
    -- Type of a point (DuckDB label)
    f1 := ST_GEOMETRYTYPE(ST_GEOMPOINT(1.0, 2.0)),
    -- Type of a polygon (DuckDB label)
    f2 := ST_GEOMETRYTYPE(
        ST_GEOMFROMTEXT('POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))')
    )
;
Result
f1 VARCHARf2 VARCHAR
POINTPOLYGON