From PostGIS doc:
"ST_Affine — Applies a 3d affine transformation to the geometry to do things like translate, rotate, scale in one step."
Here comes a quite dirty example.
Two years ago I used it to build an click-able html image map on a gif-image delivered from mapserver. The query sent to PostGIS, makes a simplified buffer around the geometry in the right pixelscale and recalculates since the image map has it's origin in upper left corner and the projection of the map has it's origin of course in the lower left corner. Then I just created the image-map by writing the returned string with asp, or if it was php.
I digged in the dirty dust and found this:
SELECT gid,
replace(
astext(
st_affine(
ST_SnapToGrid(
st_buffer(
st_transscale(
st_simplify(
(st_dump(the_geom)).geom
, (st_length(the_geom)/50)::integer)
,(-" & minx & "),(-" & miny & "),(500::double precision/" & deltax & "),(500::double precision/" & deltax & "))
,5)
,1,1)
,1,0,0,-1,0,300)
)
,' ',',')
as thetext
from
mytable where gid in (" & theList & ") order by st_length(the_geom);
Not beautiful, but it actually worked very well and served for some time.
/Nicklas