ST_TransScale — 依據給定的偏移量和比例因子,平移和縮放幾何圖形。
geometry ST_TransScale(
geometry geomA, float deltaX, float deltaY, float XFactor, float YFactor)
;
使用 deltaX 和 deltaY 參數平移幾何圖形,然後使用 XFactor 和 YFactor 參數縮放幾何圖形,僅在 2D 中運作。
![]() |
|
|
![]() |
|
在 1.3.4 之前的版本中,如果幾何圖形包含 CURVES,此函數會崩潰。此問題已在 1.3.4+ 版本中修復。 |
可用性:1.1.0。
此函數支援 3D,並且不會捨棄 z 索引。
此方法支援圓形字串和曲線。
SELECT ST_AsEWKT(ST_TransScale(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), 0.5, 1, 1, 2)); st_asewkt ----------------------------- LINESTRING(1.5 6 3,1.5 4 1) --Buffer a point to get an approximation of a circle, convert to curve and then translate 1,2 and scale it 3,4 SELECT ST_AsText(ST_Transscale(ST_LineToCurve(ST_Buffer('POINT(234 567)', 3)),1,2,3,4)); st_astext ------------------------------------------------------------------------------------------------------------------------------ CURVEPOLYGON(CIRCULARSTRING(714 2276,711.363961030679 2267.51471862576,705 2264,698.636038969321 2284.48528137424,714 2276))