Skip to content

ST_SCALE

Scales a GEOGRAPHY to a new size by multiplying the coordinates with the corresponding factor parameters.

See also:

Syntax

sql
ST_SCALE(<input>, <xfactor>, <yfactor>)

Arguments

  • <input>: A GEOGRAPHY type to scale
  • <xfactor>: A FLOAT8 scale to apply to the x-axis. Negative values are allowed
  • <yfactor>: A FLOAT8 scale to apply to the y-axis. Negative values are allowed

Returns

Returns a GEOGRAPHY of the same type as the input, scaled according to the provided factors. Using negative values will result in mirroring along that axis.

Example

sql
SELECT ST_AsText(ST_Scale('POINT(1 1)'::GEOGRAPHY, 2, 3));
-- 'POINT(2 3)'

SELECT ST_AsText(ST_Scale('LINESTRING(0 0, 1 1)'::GEOGRAPHY, 2, -2));
-- 'LINESTRING(0 0, 2 -2)'