DB2 Spatial Extender 有一些函數從文字說明產生幾何:
文字表示法是一個 ASCII 文字格式字串,它允許以 ASCII 文字形式交換幾何。 您可在第三代或第四代語言 (3GL 或 4GL) 程式中使用這些函數,因為它們不需要特殊程式結構的定義。 ST_AsText 函數將現存幾何轉換成文字表示法。
每一種幾何類型都有一個知名文字表示法, 您可使用該表示法建構該類型的新案例以及將現存案例轉換成英數顯示的文字格式。
一個幾何的知名文字表示法定義如下:表示法 {}* 表示大括弧內的 0 或更多符號重複;大括弧不出現在輸出符號列示中。
<Geometry Tagged Text> := | <Point Tagged Text> | <LineString Tagged Text> | <Polygon Tagged Text> | <MultiPoint Tagged Text> | <MultiLineString Tagged Text> | <MultiPolygon Tagged Text> <Point Tagged Text> := POINT <Point Text> <LineString Tagged Text> := LINESTRING <LineString Text> <Polygon Tagged Text> := POLYGON <Polygon Text> <MultiPoint Tagged Text> := MULTIPOINT <Multipoint Text> <MultiLineString Tagged Text> := MULTILINESTRING <MultiLineString Text> <MultiPolygon Tagged Text> := MULTIPOLYGON <MultiPolygon Text> <Point Text> := EMPTY | <Point> | Z <PointZ> | M <PointM> | ZM <PointZM> <Point> := <x> <y> <x> := double precision literal <y> := double precision literal <PointZ> := <x> <y> <z> <x> := double precision literal <y> := double precision literal <z> := double precision literal <PointM> := <x> <y> <m> <x> := double precision literal <y> := double precision literal <m> := double precision literal <PointZM> := <x> <y> <z> <m> <x> := double precision literal <y> := double precision literal <z> := double precision literal <m> := double precision literal <LineString Text> := EMPTY | ( <Point Text > {, <Point Text> }* ) | Z ( <PointZ Text > {, <PointZ Text> }* ) | M ( <PointM Text > {, <PointM Text> }* ) | ZM ( <PointZM Text > {, <PointZM Text> }* ) <Polygon Text> := EMPTY | ( <LineString Text > {,< LineString Text > }* ) <Multipoint Text> := EMPTY | ( <Point Text > {, <Point Text > }* ) <MultiLineString Text> := EMPTY | ( <LineString Text > {,< LineString Text>}* ) <MultiPolygon Text> := EMPTY | ( < Polygon Text > {, < Polygon Text > }* )
基本函數語法︰
function (<text description>,<SRID>)
SRID (空間參照識別字) 和 SPATIAL_REFERENCES 表格的主要鍵識別幾何的空間參照系統,該系統儲存在 SPATIAL_REFERENCES 表格。 將一個幾何插入空間直欄之前,它的 SRID 必須符合空間直欄的 SRID。
由單引號括住的 3 個基本元件組成文字說明,例如︰
<'幾何類型'> ['座標類型'] [''座標列示']
其中:
表 65顯示全部可能的文字表示法範例列示。
幾何類型
|
文字說明
|
註解
|
---|---|---|
點
|
point empty
|
空白點
|
點
|
point z empty
|
具有 z 座標的空白點
|
點
|
point m empty
|
具有測量的空白點
|
點
|
point zm empty
|
具有 z 座標和測量的空白點
|
點
|
point ( 10.05 10.28 )
|
點
|
點
|
point z ( 10.05 10.28 2.51 )
|
具有 z 座標的點
|
點
|
point m ( 10.05 10.28 4.72 )
|
具有測量的點
|
點
|
point zm ( 10.05 10.28 2.51 4.72 )
|
具有 z 座標和測量的點
|
線串
|
linestring empty
|
空白線串
|
線串
|
linestring z empty
|
具有 z 座標的空白線串
|
線串
|
linestring m empty
|
具有測量的空白線串
|
線串
|
linestring zm empty
|
具有 z 座標和測量的空白線串
|
線串
|
linestring ( 10.05 10.28 , 20.95 20.89 )
|
線串
|
線串
|
linestring z ( 10.05 10.28 3.09, 20.95
31.98 4.72, 21.98 29.80 3.51 )
|
具有 z 座標的線串
|
線串
|
linestring m ( 10.05 10.28 5.84, 20.95
31.98 9.01, 21.98 29.80 12.84 )
|
具有測量的線串
|
線串
|
linestring zm ( )
|
具有 z 座標和測量的線串
|
多邊形
|
polygon empty
|
空白多邊形
|
多邊形
|
polygon z empty
|
具有 z 座標的空白多邊形
|
多邊形
|
polygon m empty
|
具有測量的空白多邊形
|
多邊形
|
polygon zm empty
|
具有 z 座標和測量的空白多邊形
|
多邊形
|
polygon (( 10 10, 10 20, 20 20, 20 15, 10 10))
|
多邊形
|
多邊形
|
polygon z (( ))
|
具有 z 座標的多邊形
|
多邊形
|
polygon m (( ))
|
具有測量的多邊形
|
多邊形
|
polygon zm (( ))
|
具有 z 座標和測量的多邊形
|
多點
|
multipoint empty
|
空白多點
|
多點
|
multipoint z empty
|
具有 z 座標的空白多點
|
多點
|
multipoint m empty
|
具有測量的空白多點
|
多點
|
multipoint zm empty
|
具有 z 座標和測量的空白多點
|
多點
|
multipoint empty
|
空白多點
|
多點
|
multipoint (10 10, 20 20)
|
具有兩點的多點
|
多點
|
multipoint z (10 10 2, 20 20 3)
|
具有 z 座標的多點
|
多點
|
multipoint m (10 10 4, 20 20 5)
|
具有測量的多點
|
多點
|
multipoint zm (10 10 2 4, 20 20 3 5)
|
具有 z 座標和測量的多點
|
多線串
|
multilinestring empty
|
空白多線串
|
多線串
|
multilinestring z empty
|
具有 z 座標的空白多線串
|
多線串
|
multilinestring m empty
|
具有測量的空白多線串
|
多線串
|
multilinestring zm empty
|
具有 z 座標和測量的空白多線串
|
多線串
|
multilinestring (( ))
|
多線串
|
多線串
|
multilinestring z (( ))
|
具有 z 座標的多線串
|
多線串
|
multilinestring m (( ))
|
具有測量的多線串
|
多線串
|
multilinestring zm (( ))
|
具有 z 座標和測量的多線串
|
多重多邊形
|
multipolygon empty
|
空白多重多邊形
|
多重多邊形
|
multipolygon z empty
|
具有 z 座標的空白多重多邊形
|
多重多邊形
|
multipolygon m empty
|
具有測量的空白多重多邊形
|
多重多邊形
|
multipolygon z
|
具有 z 座標和測量的空白多重多邊形
|
多重多邊形
|
multipolygon ((( )))
|
多重多邊形
|
多重多邊形
|
multipolygon z ((( )))
|
具有 z 座標的多重多邊形
|
多重多邊形
|
multipolygon m (((10 10 2, 10 20 3, 20 20 4, 20 15 5, 10 10 2), (50 40 7,
50 50 3, 60 50 4, 60 40 5, 50 40 7)))
|
具有測量的多重多邊形
|
多重多邊形
|
multipolygon zm ((( )))
|
具有 z 座標和測量的多重多邊形
|