Skip to content

ST_GEOMETRYTYPE

Returns the type of the GEOGRAPHY as a string with 'ST_' prefix (e.g., 'ST_LineString', 'ST_Polygon', 'ST_Point').

Syntax

sql
ST_GEOMETRYTYPE(<input>)

Arguments

  • <input>: A GEOGRAPHY object to analyze

Returns

A VARCHAR containing the GEOGRAPHY type with 'ST_' prefix

Example

sql
SELECT ST_GeometryType('POINT(1 1)'::GEOGRAPHY);
-- 'ST_Point'

SELECT ST_GeometryType('POLYGON((0 0, 1 0, 1 1, 0 0))'::GEOGRAPHY);
-- 'ST_Polygon'