Functions / PostGIS / ST_Scale
PostGISAffine Transformations

ST_Scale

What is ST_Scale?

ST_Scale is a PostGIS function that multiplies each vertex's X, Y, and optionally Z coordinates by the given factors. It scales about the coordinate origin by default, or about a specified point origin when supplied.

SQL
1ST_Scale(geometry geom, float XFactor, float YFactor)geometry
2ST_Scale(geometry geom, float XFactor, float YFactor, float ZFactor)geometry
3ST_Scale(geometry geom, geometry factor)geometry
4ST_Scale(geometry geom, geometry factor, geometry origin)geometry

The geometry factor overloads take a point whose coordinates are used as scale factors.

When would you use ST_Scale?

Use ST_Scale to resize features — enlarging a symbol, stretching a CAD drawing to metric units, or mirroring geometry by scaling with a negative factor. Combined with translation to a chosen origin, it lets you resize features while keeping them visually anchored.

SQL
1-- Enlarge by 2x about the centroid:
2SELECT ST_Scale(geom, ST_MakePoint(2, 2), ST_Centroid(geom)) FROM icons;

FAQs

Why would I use a negative factor?

Negative factors mirror the geometry. ST_Scale(geom, -1, 1) flips horizontally (reflection across the Y axis), ST_Scale(geom, 1, -1) flips vertically. This is a common trick for converting between screen and map coordinate systems (where Y is inverted).

How do I scale about a specific origin?

Use the overload that takes an origin point, or manually translate the geometry so the origin is at (0, 0), scale, and translate back. ST_Scale(geom, factor, origin) is the shorthand for that triple.

Does ST_Scale affect SRID?

No — the SRID of the input is preserved. Be aware that scaling changes the physical coordinate values, so if the input was in a standard CRS the output may no longer align with that CRS's reference frame.

Can I scale by a vector supplied as a geometry?

Yes — the geometry factor overload takes a Point whose coordinates are the scale factors. This is handy when factors come from a query (e.g. stored per-feature scaling parameters) rather than hard-coded values.