ST_GEOMETRYFROMTEXT
説明
WKT(Well Known Text)を対応するメモリジオメトリに変換します
エイリアス
- ST_GEOMFROMTEXT
構文
ST_GEOMETRYFROMTEXT( <wkt>)
パラメータ
| パラメータ | Instructions |
|---|---|
<wkt> | グラフのメモリ形式 |
サポートされるWKTフォーマット
POINT- 空間内の単一点LINESTRING- 連続する線分のシーケンスPOLYGON- 1つ以上のリングで定義される閉じた領域。最低3つの異なる点と閉じた端点が必要。MULTIPOLYGON- ポリゴンのコレクション。multipolygon内のポリゴンは離散的な点のみを共有できる。
Note
Apache Doris 3.0.6からMULTIPOLYGONフォーマットの解析をサポート
戻り値
WKTに対応する幾何学的ストレージ形式のWKB
入力のWKTフォーマットが仕様に適合しない場合、または入力がNULLの場合はNULLを返します。
例
-- POINT example
SELECT ST_AsText(ST_GeometryFromText("POINT (1 1)"));
+-----------------------------------------------+
| ST_AsText(ST_GeometryFromText("POINT (1 1)")) |
+-----------------------------------------------+
| POINT (1 1) |
+-----------------------------------------------+
-- POINT illegal example(too many points)
SELECT ST_AsText(ST_GeometryFromText("POINT (1 1, 2 2)"));
+----------------------------------------------------+
| ST_AsText(ST_GeometryFromText("POINT (1 1, 2 2)")) |
+----------------------------------------------------+
| NULL |
+----------------------------------------------------+
-- LINESTRING example
SELECT ST_AsText(ST_GeometryFromText("LINESTRING (1 1, 2 2)"));
+---------------------------------------------------------+
| st_astext(st_geometryfromtext('LINESTRING (1 1, 2 2)')) |
+---------------------------------------------------------+
| LINESTRING (1 1, 2 2) |
+---------------------------------------------------------+
-- LINESTRING illegal example(too few verteices)
SELECT ST_AsText(ST_GeometryFromText("LINESTRING (1 1)"));
+----------------------------------------------------+
| ST_AsText(ST_GeometryFromText("LINESTRING (1 1)")) |
+----------------------------------------------------+
| NULL |
+----------------------------------------------------+
-- POLYGON example
SELECT ST_AsText(ST_GeometryFromText("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))"));
+-----------------------------------------------------------------------+
| ST_AsText(ST_GeometryFromText("POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0))")) |
+-----------------------------------------------------------------------+
| POLYGON ((0 0, 1 0, 1 1, 0 1, 0 0)) |
+-----------------------------------------------------------------------+
-- POLYGON illegal example(not closed end to end)
SELECT ST_AsText(ST_GeometryFromText("POLYGON ((0 0, 1 0, 1 1, 0 1))"));
+------------------------------------------------------------------+
| ST_AsText(ST_GeometryFromText("POLYGON ((0 0, 1 0, 1 1, 0 1))")) |
+------------------------------------------------------------------+
| NULL |
+------------------------------------------------------------------+
-- POLYGON illegal example(too few verteices)
SELECT ST_AsText(ST_GeometryFromText("POLYGON ((0 0, 1 0, 0 0))"));
+-------------------------------------------------------------+
| ST_AsText(ST_GeometryFromText("POLYGON ((0 0, 1 0, 0 0))")) |
+-------------------------------------------------------------+
| NULL |
+-------------------------------------------------------------+
-- MULTIPOLYGON example
SELECT ST_AsText(ST_GeometryFromText("MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)))"));
+-----------------------------------------------------------------------------------------------------------+
| ST_AsText(ST_GeometryFromText("MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 2, 3 2, 3 3, 2 3, 2 2)))")) |
+-----------------------------------------------------------------------------------------------------------+
| MULTIPOLYGON (((0 0, 1 0, 1 1, 0 1, 0 0)), ((2 2, 3 2, 3 3, 2 3, 2 2))) |
+-----------------------------------------------------------------------------------------------------------+
-- MULTIPOLYGON example (polygons in multipolygon only share discrete points.)
SELECT ST_AsText(ST_GeometryFromText("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4)), ((4 5, 5 4, 6 5, 5 6, 4 5)))"));
+------------------------------------------------------------------------------------------------------------------------------------------+
| ST_AsText(ST_GeometryFromText("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4)), ((4 5, 5 4, 6 5, 5 6, 4 5)))")) |
+------------------------------------------------------------------------------------------------------------------------------------------+
| MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0), (4 4, 6 4, 6 6, 4 6, 4 4)), ((4 5, 5 4, 6 5, 5 6, 4 5))) |
+------------------------------------------------------------------------------------------------------------------------------------------+
-- MULTIPOLYGON illegal example(overlap exists)
SELECT ST_AsText(ST_GeometryFromText("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0)), ((10 0, 20 0, 20 10, 10 10, 10 0)))"));
+----------------------------------------------------------------------------------------------------------------------+
| ST_AsText(ST_GeometryFromText("MULTIPOLYGON (((0 0, 10 0, 10 10, 0 10, 0 0)), ((10 0, 20 0, 20 10, 10 10, 10 0)))")) |
+----------------------------------------------------------------------------------------------------------------------+
| NULL |
+----------------------------------------------------------------------------------------------------------------------+
-- input NULL
SELECT ST_AsText(ST_GeometryFromText(NULL));
+--------------------------------------+
| ST_AsText(ST_GeometryFromText(NULL)) |
+--------------------------------------+
| NULL |
+--------------------------------------+