Catégories :

Fonctions géospatiales

ST_ASEWKT

Si la valeur est de type GEOGRAPHY ou GEOMETRY, renvoie la représentation du texte (VARCHAR) de cette valeur au format EWKT (texte bien connu étendu).

Voir aussi :

ST_ASWKT

Syntaxe

ST_ASEWKT( <geography_or_geometry_expression> ) 
Copy

Arguments

geography_or_geometry_expression

L’argument doit être une expression de type GEOGRAPHY ou GEOMETRY.

Renvoie

Un VARCHAR.

Notes sur l’utilisation

Exemples

Exemples GEOGRAPHY

L’exemple suivant illustre la fonction ST_ASEWKT :

create table geospatial_table (id INTEGER, g GEOGRAPHY); insert into geospatial_table values (1, 'POINT(-122.35 37.55)'), (2, 'LINESTRING(-124.20 42.00, -120.01 41.99)'); 
Copy
select st_asewkt(g) from geospatial_table order by id; +-----------------------------------------------+ | ST_ASEWKT(G) | |-----------------------------------------------| | SRID=4326;POINT(-122.35 37.55) | | SRID=4326;LINESTRING(-124.2 42,-120.01 41.99) | +-----------------------------------------------+ 
Copy

Exemples GEOMETRY

L’exemple ci-dessous montre comment utiliser la fonction ST_ASEWKT. L’exemple renvoie les représentations EWKT de deux géométries qui ont des SRIDs différents.

CREATE OR REPLACE TABLE geometry_table (g GEOMETRY); INSERT INTO geometry_table VALUES ('SRID=4326;POINT(-122.35 37.55)'), ('SRID=0;LINESTRING(0.75 0.75, -10 20)'); ALTER SESSION SET GEOMETRY_OUTPUT_FORMAT='EWKT'; SELECT ST_ASEWKT(g) FROM geometry_table; 
Copy
+-------------------------------------+ | ST_ASEWKT(G) | |-------------------------------------| | SRID=4326;POINT(-122.35 37.55) | | SRID=0;LINESTRING(0.75 0.75,-10 20) | +-------------------------------------+ 
Copy