# Use cases

Similarity and affine transformations are useful when integrating spatial data from several sources. It is often the case that vectors from one dataset (let's call it 'A') don't coincide with a base dataset ('B'), which could be raster or vector. In such a scenario one would like to reposition the dataset A taking the other dataset ('B') as reference.

There are a number of cases when this situation occurs, including but not limited to:

- The dataset A lacks of projection data and there is no hint about it.
- The dataset A was already projected but simply doesn't fit well with B (think about data in local datums when migrated to WGS84.)
- The dataset A has an arbitrary/false coordinate reference system and it's going to be integrated with national data, e.g. archaeological or engineering projects.
- The dataset A was digitized from a distorted image like a scanned old map.
- The dataset A was digitized from a wrongly georeferenced satellite image (it recently happened in OpenStreetMap.)

# The package 'vec2dtransf'

The R package 'vec2dtransf' provides classes for defining and applying both affine and similarity transformations on vector data, namely on 'sp' objects (objects created by the R package called 'sp'.) Transformations can be defined from control points or directly from transformation parameters. If redundant control points are provided Least Squares is applied allowing to obtain residuals and RMSE (Root Mean Square Error.)

Similarity transformations can rotate, shift and scale geometries, whereas affine transformations can rotate, shift, scale (even applying different factors on each axis) and skew geometries. At least two (2) control points are required for similarity and three (3) for affine transformations. See (Knippers, 2009) for an introduction to the formulae of each…