ST_Scale — 按给定因子缩放几何图形。
geometry ST_Scale(
geometry geomA, float XFactor, float YFactor, float ZFactor)
;
geometry ST_Scale(
geometry geomA, float XFactor, float YFactor)
;
geometry ST_Scale(
geometry geom, geometry factor)
;
geometry ST_Scale(
geometry geom, geometry factor, geometry origin)
;
通过将纵坐标与相应的系数参数相乘,将几何图形缩放到新尺寸。
将几何体作为 factor
参数允许传递2d、3dm、3dz或4d点来为所有支持的维度设置比例因子。中缺少的维度 factor
点等效于不缩放相应的尺寸。
三几何图形变量允许传入用于缩放的“假原点”。例如,使用几何体的质心作为假原点,这样就可以进行“原地缩放”。如果没有假原点,则会相对于实际原点进行缩放,因此所有坐标都将与比例因子相乘。
![]() | |
在1.3.4之前的版本中,如果与包含曲线的几何体一起使用,此函数会崩溃。这在1.3.4+中已修复 |
可用性:1.1.0。
增强:2.0.0引入了对多面体曲面、三角形和三角网的支持。
增强:2.2.0支持扩展所有维度( factor
参数)。
增强:2.5.0支持相对于本地源进行缩放( origin
参数)。
This function supports Polyhedral surfaces.
This function supports 3d and will not drop the z-index.
This method supports Circular Strings and Curves
This function supports Triangles and Triangulated Irregular Network Surfaces (TIN).
This function supports M coordinates.
--Version 1: scale X, Y, Z SELECT ST_AsEWKT(ST_Scale(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), 0.5, 0.75, 0.8)); st_asewkt -------------------------------------- LINESTRING(0.5 1.5 2.4,0.5 0.75 0.8) --Version 2: Scale X Y SELECT ST_AsEWKT(ST_Scale(ST_GeomFromEWKT('LINESTRING(1 2 3, 1 1 1)'), 0.5, 0.75)); st_asewkt ---------------------------------- LINESTRING(0.5 1.5 3,0.5 0.75 1) --Version 3: Scale X Y Z M SELECT ST_AsEWKT(ST_Scale(ST_GeomFromEWKT('LINESTRING(1 2 3 4, 1 1 1 1)'), ST_MakePoint(0.5, 0.75, 2, -1))); st_asewkt ---------------------------------------- LINESTRING(0.5 1.5 6 -4,0.5 0.75 2 -1) --Version 4: Scale X Y using false origin SELECT ST_AsText(ST_Scale('LINESTRING(1 1, 2 2)', 'POINT(2 2)', 'POINT(1 1)'::geometry)); st_astext --------------------- LINESTRING(1 1,3 3)