카테고리:

지리 공간 함수

ST_ASWKT , ST_ASTEXT¶

Given a value of type GEOGRAPHY or GEOMETRY, return the text (VARCHAR) representation of that value in WKT (well-known text) format.

참고 항목:

ST_ASEWKT

구문¶

다음 중 하나를 사용하십시오.

ST_ASWKT( <geography_or_geometry_expression> )

ST_ASTEXT( <geography_or_geometry_expression> )


인자¶

geography_or_geometry_expression

The argument must be an expression of type GEOGRAPHY or GEOMETRY.

VARCHAR입니다.

사용법 노트¶

• ST_ASTEXT는 ST_ASWKT의 별칭입니다.

• 출력을 EWKT 형식으로 반환하려면 대신 ST_ASEWKT 를 사용하십시오.

예¶

GEOGRAPHY Examples¶

다음 예는 ST_ASWKT 함수를 보여줍니다.

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)');

select st_astext(g)
from geospatial_table
order by id;
+-------------------------------------+
| ST_ASTEXT(G)                        |
|-------------------------------------|
| POINT(-122.35 37.55)                |
| LINESTRING(-124.2 42,-120.01 41.99) |
+-------------------------------------+

select st_aswkt(g)
from geospatial_table
order by id;
+-------------------------------------+
| ST_ASWKT(G)                         |
|-------------------------------------|
| POINT(-122.35 37.55)                |
| LINESTRING(-124.2 42,-120.01 41.99) |
+-------------------------------------+


GEOMETRY Examples¶

The example below demonstrates how to use the ST_ASEWKT function. The example returns the EWKT representations of two geometries.

CREATE OR REPLACE TABLE geometry_table (g GEOMETRY);
INSERT INTO geometry_table VALUES
('POINT(-122.35 37.55)'), ('LINESTRING(0.75 0.75, -10 20)');

ALTER SESSION SET GEOMETRY_OUTPUT_FORMAT='WKT';
SELECT ST_ASWKT(g) FROM geometry_table;

+------------------------------+
| ST_ASWKT(G)                  |
|------------------------------|
| POINT(-122.35 37.55)         |
| LINESTRING(0.75 0.75,-10 20) |
+------------------------------+

맨 위로 이동