ST_GeometryType - Amazon Redshift

Amazon Redshift non supporterà più la creazione di nuove UDF Python a partire dal 1º novembre 2025. Se desideri utilizzare le UDF Python, creale prima di tale data. Le UDF Python esistenti continueranno a funzionare normalmente. Per ulteriori informazioni, consulta il post del blog.

ST_GeometryType

GeometryType ritorna, sotto forma di stringa, il sottotipo di un oggetto geometrico passato come input.

Per gli input di geometria 3DM, 3DZ e 4D, ST_GeometryType restituisce lo stesso risultato degli input della geometria 2D.

Sintassi

ST_GeometryType(geom)

Argomenti

geom

Un valore di tipo GEOMETRY o un'espressione che restituisce un valore di tipo GEOMETRY.

Tipo restituito

VARCHAR che rappresenta il sottotipo di geom.

Se geom è nullo, allora viene restituito il valore nullo.

I valori restituiti sono i seguenti.

Valore stringa restituito Sottotipo dato di tipo geometry

ST_Point

Restituito se geom è di sottotipo POINT

ST_LineString

Restituito se geom è di sottotipo LINESTRING

ST_Polygon

Restituito se geom è di sottotipo POLYGON

ST_MultiPoint

Restituito se geom è di sottotipo MULTIPOINT

ST_MultiLineString

Restituito se geom è di sottotipo MULTILINESTRING

ST_MultiPolygon

Restituito se geom è di sottotipo MULTIPOLYGON

ST_GeometryCollection

Restituito se geom è di sottotipo GEOMETRYCOLLECTION

Esempi

Il seguente comando SQL restituisce il sottotipo dell'oggetto geometrico linestring in input.

SELECT ST_GeometryType(ST_GeomFromText('LINESTRING(77.29 29.07,77.42 29.26,77.27 29.31,77.29 29.07)'));
st_geometrytype ------------- ST_LineString