Name

ST_Scale — Scales the geometry to a new size by multiplying the coordinates by the factor of scale of the axis.

Synopsis

geometry ST_Scale(bytea Geometry, double XScale, double YScale, double ZScale);

geometry ST_Scale(bytea Geometry, double XScale, double YScale);

Alias

Scale

Description

Scales the geometry to a new size by multiplying the coordinates by the factor of scale of the axis.

Transformation matrix

Equations to transform the vertices

[Note]

ST_Scale (geomA, XScale, YScale, ZScale) is an abreviation for the method:

ST_Affine(geomA, XFactor, 0, 0, 0, YFactor, 0, 0, 0, ZFactor, 0, 0, 0)

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
----

Examples

SELECT ST_AsEWKT(ST_Scale(ST_GeomFromEWKT('POINT (10 10 10 4)'),0.5,1,2));
--Result
POINT (5 10 20 4)

SELECT ST_AsEWKT(ST_Scale(ST_GeomFromEWKT('LINESTRING (10 10, 5 2)'),2,4));
--Result
LINESTRING (20 40, 10 8)

--Same Transformation with ST_Affine
SELECT ST_AsEWKT(ST_Affine(geomA, XFactor, 0, 0, 0, YFactor, 0, 0, 0, ZFactor, 0, 0, 0)) 
FROM (SELECT ST_GeomFromEWKT('LINESTRING (10 10, 5 2)') as geomA, 2 as XFactor, 4 as YFactor, 1 as ZFactor) as foo;
--Result
LINESTRING (20 40, 10 8)

Related functions

ST_Affine