17.00 - 17.05 - 例: ST_Transform - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - 地理空間データ型

Product
Advanced SQL Engine
Teradata Database
Release Number
17.00
17.05
Release Date
2020年6月
Content Type
プログラミング リファレンス
Publication ID
B035-1181-170K-JPN
Language
日本語 (日本)
   SELECT R.skey, R.shape.ST_Transform(X.srtext, Y.srtext)
   FROM sample_shapes R ,
        SYSSPATIAL.SPATIAL_REF_SYS X ,
        SYSSPATIAL.SPATIAL_REF_SYS Y
   WHERE  X.AUTH_SRID = 4326 and Y.AUTH_SRID = 3149;

次に、toSRSid引数の使用例を示します。

CREATE TABLE customers(pkey INTEGER, point ST_Geometry);
INSERT INTO customers VALUES(0, new ST_Geometry('POINT(-89.39 43.09)', 1619));
INSERT INTO customers VALUES(1, new ST_Geometry('POINT(-87.65 41.90)', 1619));

CREATE TABLE transformed_customers2(pkey INTEGER, point ST_Geometry);
INSERT INTO transformed_customers2
SELECT pkey,
       point.ST_Transform(3054, X.srtext, Y.srtext)
FROM customers,
     SYSSPATIAL.SPATIAL_REF_SYS X,
     SYSSPATIAL.SPATIAL_REF_SYS Y
WHERE X.AUTH_SRID = 32616 AND    -- UTM 16 / WGS84
      Y.AUTH_SRID = 4326         -- WGS84

;
;SELECT pkey,
       point.ST_SRID(),
       point
FROM transformed_customers2
ORDER BY pkey;

       pkey point.ST_SRID() point
----------- --------------- ------------------------------------------------
          0            3054 POINT (305475.753263251972385 4773581.672131018)
          1            3054 POINT (446084.218845848692581 4638877.682686116)