Real-world example of Affine Transform?

From the Wikipedia article:

In geometry, an affine transformation or affine map or an affinity (from the Latin, affinis, "connected with") between two vector spaces (strictly speaking, two affine spaces) consists of a linear transformation followed by a translation.

Can anyone give a real-world example of when and how this is used in GIS?

-

Routine uses of 2D and 3D affine transformations in GIS include

• Map-to-display transformations

• Registering images and rasters

• Changing 3D viewpoints

• Modifying features by rescaling, shifting, and rotation

• Datum changes (3-point and 7-point formulas).

These are described in more detail and illustrated for the 2D case on this Web page, which is found when you search "affine transformation GIS". Other hits provide many more examples.

Affine transformations also provide some conceptual simplifications. For example, every regular grid of locations is affinely equivalent to the grid of points with integral coordinates and all ellipsoidal models of the earth are affinely equivalent to the unit sphere centered at the origin.

Finally, note that (at least since the late 1800's) Euclidean geometry is the study of the group of distance-preserving affine transformations. Because almost all GIS processing--spatial indexes, spatial relations, spatial queries, "geoprocessing," etc--uses algorithms based on the Euclidean geometry of the map, affine transformations are fundamental to GIS.

-

Display

All viewers use affine transforms to convert geographic coordinates into screen coordinates.

Generalisation

Many transformation operations used in generalisation are affine transforms: scale, stretching, translation, rotation, etc.

-

http://ian01.geog.psu.edu/geoserver/www/cartogram/discontinous.html shows a discontinuous cartogram I construct using a simple affine transformation.

-
+1 Note that this is a collection of affine transformations, one per state, not just a single transformation. One can conceive of all cartograms as creating one transformation for each feature, but in most cases those transformations are more complicated than affine ones (and often are not differentiable or even continuous). – whuber Dec 20 '10 at 19:32

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

-

It's just a linear transformation of an image or dataset - this means that all coordinates in the dataset are treated equally. E.g. if the point at (x1, y1) is scaled by a and shifted by b then all other points (x2, y2), (x3, y3), (xn, yn) will also be scaled by a and shifted by b etc... There is no dependence on where in the dataset or image the pixels reside.

-
Affine transformations are generalizations of linear transforms. Unlike a linear transform, an affine transform can also translate (shift) points. – whuber Dec 19 '10 at 23:03

When I recieve a map that is either paper or digital image with no access to the vector data, and I need information from the map to overlay with other data. If the map is not printed or exported in the same or similar coordinate system as my data then I need to not only register (place, rotate, scale). But to transform it.

The two ways this can be done.
1. digitize in the system the image was printed in and then assign the appropriate coordinate system and then re-project the data. Or...
2. place, rotate, and scale to a position close to the final and perform transformation.

When choosing the transformation type you are restricted by the number of identifiable reference points in both datasets.

I ussually (depends on a lot of factors) choose to locate the image close to it's final resting place and then perform a rubbersheet transformation.

Affine is one of the choices I have when I utilize a larger number of reference points.

-