ST_TransScale
Prev | 8.15. Affine Transformations | Next

## Name

ST_TransScale — Translates and scales a geometry by given offsets and factors.

## Synopsis

`geometry ST_TransScale(`geometry geomA, float deltaX, float deltaY, float XFactor, float YFactor`)`;

## Description

Translates the geometry using the deltaX and deltaY args, then scales it using the XFactor, YFactor args, working in 2D only.

`ST_TransScale(geomA, deltaX, deltaY, XFactor, YFactor)` is short-hand for `ST_Affine(geomA, XFactor, 0, 0, 0, YFactor, 0, 0, 0, 1, deltaX*XFactor, deltaY*YFactor, 0)`.

Prior to 1.3.4, this function crashes if used with geometries that contain CURVES. This is fixed in 1.3.4+

Availability: 1.1.0.

This function supports 3d and will not drop the z-index.

This method supports Circular Strings and Curves

## Examples

    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))

## See Also

ST_Affine, ST_Translate

Prev | Up | Next
ST_Translate | Home | ST_ClusterDBSCAN