例: Tessellate_Search関数 - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ 地理空間データ型

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
2019年3月
Language
日本語
Last Update
2019-10-29
dita:mapPath
ja-JP/swn1512082023009.ditamap
dita:ditavalPath
ja-JP/swn1512082023009.ditaval
dita:id
B035-1181
Product Category
Software
Teradata Vantage
CREATE TABLE sample_cities(
 skey INTEGER, cityName VARCHAR(200), cityShape ST_Geometry);

INSERT INTO sample_cities values(
 1067, New ST_Geometry('Polygon(
  (-43.5 20.2, -43.5 21.5, -40.5 21.5, -40.5 20.2, -43.5 20.2))'));


Tessellate_Indexメソッドを使用して挿入されたcities_indexテーブルに含まれるデータについて考察します。

CREATE TABLE cities_index
   (skey INTEGER
   ,cellid INTEGER);

INSERT INTO cities_index
SELECT skey,
   cityShape.Tessellate_Index(-180, 0, 0, 90, 500, 500, 1, 0.01, 0)
FROM sample_cities;

次に示す文では、Tessellate_Indexで使用したものと同じ母領域の座標とグリッド指定でTessellate_Search関数を使用します。

SELECT c.skey, c.cityName, s.streetName, s.streetShape
FROM sample_cities c
    ,cities_index ci
    ,(SELECT streetName, skey, streetShape ,streetShape.ST_MBR_Xmin()
            ,streetShape.ST_MBR_Ymin(), streetShape.ST_MBR_Xmax()
            ,streetShape.ST_MBR_Ymax()
      FROM sample_streets)
      AS s (streetName, skey, streetShape, xmin, ymin, xmax, ymax)
    ,TABLE ( Tessellate_Search (
                s.skey
               ,s.xmin, s.ymin, s.xmax, s.ymax
               ,-180, 0, 0, 90
               ,500,500
               ,1, 0.01, 0)) AS t
WHERE c.skey = ci.skey
AND ci.cellid = t.cellid
AND t.out_key = s.skey;