ST_ 轉換 - Amazon Redshift

# ST_ 轉換

st_transform 會傳回座標的新幾何圖形，這些座標會在由輸入空間參考系統識別元 (SRID) 定義的空間參考系統中轉換。

## 語法

``ST_Transform(geom, srid)``

## 引數

geom

`GEOMETRY` 資料類型的值，或是評估為 `GEOMETRY` 類型的表達式。

srid

## 傳回類型

`GEOMETRY`.

## 範例

``SELECT ST_AsEWKT(ST_Transform(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY', 3857), 4326));``
``````
st_asewkt
------------------------------------
SRID=4326;GEOMETRYCOLLECTION EMPTY
``````

``SELECT ST_AsEWKT(ST_Transform(ST_GeomFromText('LINESTRING(110 40, 2 3, -10 80, -7 9, -22 -33)', 4326), 26918));``
``````
st_asewkt
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SRID=26918;LINESTRING(73106.6977300955 15556182.9688576,14347201.5059964 1545178.32934967,1515090.41262989 9522193.25115316,10491250.83295 2575457.28410878,5672303.72135968 -5233682.61176205)
``````

``SELECT ST_AsEWKT(ST_Transform(ST_GeomFromText('POLYGON Z ((-10 10 -7, -65 10 -6, -10 64 -5, -10 10 -7), (-11 11 5, -11 12 6, -12 11 7, -11 11 5))', 6989), 6317));``
``````
st_asewkt
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
SRID=6317;POLYGON Z ((6186430.2771091 -1090834.57212608 1100247.33216237,2654831.67853801 -5693304.90741276 1100247.50581055,2760987.41750022 -486836.575101877 5709710.44137268,6186430.2771091 -1090834.57212608 1100247.33216237),(6146675.25029258 -1194792.63532103 1209007.1115113,6125027.87562215 -1190584.81194058 1317403.77865723,6124888.99555252 -1301885.3455052 1209007.49312929,6146675.25029258 -1194792.63532103 1209007.1115113))
``````